/* style.css — внешний вид всех страниц. Чёрно-белая тема.
   Цвета, скругления и скорость анимаций вынесены в переменные (--...), чтобы менять всё в одном месте. */
:root {
  --ink: #0a0a0a;             /* основной чёрный */
  --ink-2: #262626;
  --bg: #f4f4f2;              /* тёплый светло-серый фон */
  --card: #ffffff;
  --line: #e6e6e3;
  --line-2: #d4d4d0;
  --text: #111111;
  --muted: #76766f;
  --soft: #efefec;
  --ok: #111111;
  --bad: #b42318;
  --bad-soft: #fdf0ee;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .05);
  --shadow-up: 0 2px 4px rgba(0, 0, 0, .05), 0 22px 44px rgba(0, 0, 0, .12);
  --ease: cubic-bezier(.2, .8, .2, 1);   /* «пружинистое» замедление */
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: 'Inter', 'Segoe UI', Arial, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-underline-offset: 3px; }
::selection { background: var(--ink); color: #fff; }
svg.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Анимации ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes glow { 0%, 100% { opacity: .35; } 50% { opacity: .6; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Элементы с классом reveal и плитки появляются по очереди */
.reveal, .tiles > *, .page > h1, .page > .sub { animation: rise .5s var(--ease) both; }
.tiles > *:nth-child(2) { animation-delay: .04s; } .tiles > *:nth-child(3) { animation-delay: .08s; }
.tiles > *:nth-child(4) { animation-delay: .12s; } .tiles > *:nth-child(5) { animation-delay: .16s; }
.tiles > *:nth-child(6) { animation-delay: .2s; }  .tiles > *:nth-child(n+7) { animation-delay: .24s; }
.reveal:nth-child(2) { animation-delay: .06s; } .reveal:nth-child(3) { animation-delay: .12s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Верхняя панель ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; background: rgba(10, 10, 10, .92); backdrop-filter: blur(12px); color: #fff; padding: 0 32px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { height: 30px; display: block; }
.top .brand img { filter: invert(1); }   /* чёрный логотип на тёмной панели делаем белым */
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: #fff; color: var(--ink); display: grid; place-items: center; transition: transform .4s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.brand-mark svg { width: 22px; height: 22px; stroke-width: 1.9; }
.brand b { font-size: 16px; letter-spacing: .22em; }
.brand span { display: block; font-size: 11px; opacity: .55; letter-spacing: .06em; }
.topnav { display: flex; gap: 2px; margin-left: auto; }
.topnav a { position: relative; display: inline-flex; align-items: center; gap: 8px; color: #fff; opacity: .6; text-decoration: none; font-size: 14px; padding: 8px 14px; border-radius: 10px; transition: opacity .2s, background .2s; }
.topnav a::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px; background: #fff; border-radius: 2px; transform: scaleX(0); transition: transform .3s var(--ease); }
.topnav a:hover { opacity: 1; background: rgba(255, 255, 255, .07); }
.topnav a.on { opacity: 1; }
.topnav a.on::after, .topnav a:hover::after { transform: scaleX(1); }
.topnav svg { width: 17px; height: 17px; }
.user { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 1.3; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--ink); display: grid; place-items: center; font-weight: 700; }
.user a { color: #fff; opacity: .6; text-decoration: none; font-size: 12px; transition: opacity .2s; }
.user a:hover { opacity: 1; }
.role-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 7px; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .3); margin-left: 4px; opacity: .8; }
@media (max-width: 860px) { .topnav { display: none; } .user { margin-left: auto; } }

.page { padding: 36px 32px 64px; max-width: 1320px; margin: 0 auto; }
h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.025em; font-weight: 700; }
.sub { color: var(--muted); margin: 0 0 28px; }

/* ---------- Сообщения ---------- */
.flashes { position: fixed; top: 76px; right: 24px; z-index: 50; display: grid; gap: 8px; }
.flash { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-up); animation: slideIn .4s var(--ease) both, fade .4s 4s reverse forwards; }
.flash.error { background: var(--bad); }

/* ---------- Вход ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: #0a0a0a; color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
/* Мягкий «свет лампы» и тонкая сетка на чёрном фоне */
.login-hero::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(circle at 70% 20%, #000 0, transparent 70%); }
.login-hero::after { content: ''; position: absolute; right: -160px; top: -160px; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 65%); animation: glow 6s ease-in-out infinite; }
.login-hero > * { position: relative; z-index: 1; }
.login-hero .brand img { filter: invert(1); height: 36px; }
.login-hero h1 { font-size: 46px; line-height: 1.08; margin: 40px 0 16px; max-width: 480px; letter-spacing: -.035em; animation: rise .7s var(--ease) .1s both; }
.login-hero p { opacity: .6; max-width: 420px; line-height: 1.55; animation: rise .7s var(--ease) .2s both; }
.hero-list { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.hero-list li { display: flex; gap: 14px; align-items: center; opacity: .9; animation: rise .6s var(--ease) both; }
.hero-list li:nth-child(1) { animation-delay: .3s; } .hero-list li:nth-child(2) { animation-delay: .4s; } .hero-list li:nth-child(3) { animation-delay: .5s; }
.hero-list .dot { width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .18); display: grid; place-items: center; }
.hero-foot { font-size: 12px; opacity: .4; }
.login-side { display: grid; place-items: center; padding: 32px; background: #fff; }
.login-card { width: 100%; max-width: 380px; animation: rise .6s var(--ease) .15s both; }
.login-card h2 { font-size: 30px; margin: 0 0 6px; letter-spacing: -.02em; }
.login-card .error { animation: shake .4s; }
@media (max-width: 900px) { .login-wrap { grid-template-columns: 1fr; } .login-hero { display: none; } }

/* ---------- Поля ввода ---------- */
label, .label { display: block; font-size: 13px; font-weight: 500; color: #3a3a36; margin: 12px 0; }
input, select { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font: inherit; font-size: 14px; color: var(--text); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; transition: border-color .2s, box-shadow .2s, background .2s; }
input:hover, select:hover { border-color: #a9a9a3; }
input:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(0, 0, 0, .07); }
input[readonly] { background: var(--soft); color: var(--muted); }
small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; }

/* ---------- Кнопки ---------- */
button, .btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: 12px; padding: 11px 18px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; isolation: isolate;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .2s, color .2s, border-color .2s; }
button svg { width: 18px; height: 18px; transition: transform .3s var(--ease); }
button:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 0, 0, .18); }
button:hover svg { transform: scale(1.12); }
button:active { transform: translateY(0) scale(.96); box-shadow: 0 2px 6px rgba(0, 0, 0, .15); transition-duration: .08s; }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
button.full { width: 100%; margin-top: 10px; padding: 14px; }
button.ghost { background: #fff; color: var(--ink); border-color: var(--line-2); }
button.ghost:hover { border-color: var(--ink); box-shadow: 0 8px 18px rgba(0, 0, 0, .08); }
button.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
button.danger:hover { color: var(--bad); border-color: var(--bad); }
button:disabled, button:disabled:hover { background: #d9d9d5; border-color: #d9d9d5; color: #fff; cursor: not-allowed; transform: none; box-shadow: none; }
/* «Волна» от точки нажатия — круг создаёт ui-скрипт в base.html */
.rip { position: absolute; border-radius: 50%; background: currentColor; opacity: .25; transform: scale(0); animation: ripple .6s ease-out forwards; pointer-events: none; z-index: -1; }
.error { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: 14px; }

/* ---------- Плитки выбора ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tile { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform .35s var(--ease), border-color .25s, box-shadow .35s var(--ease); }
/* Стрелка, которая выезжает при наведении */
.tile::after { content: '→'; position: absolute; right: 22px; bottom: 18px; font-size: 20px; opacity: 0; transform: translateX(-10px); transition: opacity .3s, transform .35s var(--ease); }
.tile:hover { transform: translateY(-4px); border-color: var(--ink); box-shadow: var(--shadow-up); }
.tile:hover::after { opacity: 1; transform: none; }
.tile:active { transform: translateY(-1px) scale(.985); transition-duration: .1s; }
.tile .ico { width: 48px; height: 48px; border-radius: 13px; background: var(--soft); color: var(--ink); display: grid; place-items: center; transition: background .3s, color .3s, transform .4s var(--ease); }
.tile:hover .ico { background: var(--ink); color: #fff; transform: rotate(-6deg) scale(1.05); }
.tile .ico svg { width: 24px; height: 24px; }
.tile b { font-size: 16px; letter-spacing: -.01em; }
.tile span { font-size: 13px; color: var(--muted); line-height: 1.45; padding-right: 18px; }
.tile .badge { position: absolute; top: 20px; right: 20px; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; background: var(--ink); color: #fff; padding-right: 10px; }
.tile .badge::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #fff; margin-right: 6px; vertical-align: 1px; animation: glow 2s infinite; }
.tile.disabled { box-shadow: none; background: transparent; border-style: dashed; cursor: default; }
.tile.disabled::after { display: none; }
.tile.disabled:hover { transform: none; border-color: var(--line-2); box-shadow: none; }
.tile.disabled:hover .ico { background: var(--soft); color: #a3a39c; transform: none; }
.tile.disabled .ico { color: #a3a39c; }
.tile.disabled b { color: #8a8a83; }
.tile.disabled .badge { background: var(--soft); color: var(--muted); }
.tile.disabled .badge::before { display: none; }
.tile.warn { border-style: dashed; box-shadow: none; background: transparent; }
.tile.warn .ico { color: #a3a39c; }
.tiles.big { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.tiles.big .tile { padding: 30px; min-height: 200px; }
.tiles.big .tile b { font-size: 20px; }
.tiles.big .tile .ico { width: 58px; height: 58px; border-radius: 15px; }
.tiles.big .tile .ico svg { width: 28px; height: 28px; }

/* ---------- Шаги мастера ---------- */
.stepper { display: flex; gap: 8px; margin: 0 0 22px; flex-wrap: wrap; animation: fade .4s both; }
.step { display: flex; align-items: center; gap: 8px; padding: 7px 15px 7px 7px; background: #fff; border: 1px solid var(--line); border-radius: 30px; font-size: 13px; color: var(--muted); transition: all .3s var(--ease); }
.step i { width: 24px; height: 24px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; font-style: normal; font-weight: 600; font-size: 12px; transition: all .3s var(--ease); }
.step.done { color: var(--text); cursor: pointer; }
.step.done:hover { border-color: var(--ink); transform: translateY(-1px); }
.step.done i { background: var(--ink); color: #fff; }
.step.now { color: #fff; background: var(--ink); border-color: var(--ink); font-weight: 600; }
.step.now i { background: #fff; color: var(--ink); animation: pop .4s var(--ease); }
.crumbs { font-size: 13px; color: var(--muted); margin: -8px 0 20px; }
.crumbs a { text-decoration: none; color: var(--muted); transition: color .2s; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Форма и результат ---------- */
.cols { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 980px) { .cols { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
#build .card { animation: rise .45s var(--ease) both; }
#build #result { animation-delay: .08s; }
.form-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.form-head .ico { width: 48px; height: 48px; border-radius: 13px; background: var(--ink); color: #fff; display: grid; place-items: center; }
.form-head h2 { margin: 0; font-size: 21px; letter-spacing: -.015em; }
.form-head span { font-size: 13px; color: var(--muted); }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 20px 0 0; padding: 14px 0 0; }
legend { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; padding-right: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid2 > .wide { grid-column: 1 / -1; }
label.check { display: flex; gap: 10px; align-items: center; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; transition: border-color .2s, background .2s; }
label.check:hover { border-color: var(--ink); }
label.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.fixed { font-size: 13px; color: #3a3a36; margin: 12px 0; padding: 11px 13px; background: var(--soft); border-radius: 10px; }
.fixed b { color: var(--ink); }
.fixed small { display: inline; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips label { margin: 0; cursor: pointer; }
.chips input { display: none; }
.chips span { display: inline-block; padding: 8px 15px; border: 1px solid var(--line-2); border-radius: 20px; font-size: 13px; background: #fff; transition: all .25s var(--ease); }
.chips span:hover { border-color: var(--ink); transform: translateY(-1px); }
.chips input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; animation: pop .3s var(--ease); }

#result { position: sticky; top: 84px; padding: 0; overflow: hidden; }
/* Чёрная «этикетка» с артикулом */
.label-card { position: relative; overflow: hidden; background: #0a0a0a; color: #fff; padding: 26px; }
.label-card::after { content: ''; position: absolute; right: -90px; top: -90px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 65%); pointer-events: none; }
.label-card .cap { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; opacity: .5; }
.article { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 25px; font-weight: 700; margin: 10px 0 18px; word-break: break-all; line-height: 1.6; }
.article span { display: inline-block; padding: 1px 6px; border-radius: 6px; animation: pop .35s var(--ease) both; }
.article .sep { color: rgba(255, 255, 255, .35); padding: 0 1px; animation: none; }
.label-card .row { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.label-card button { background: #fff; color: var(--ink); border-color: #fff; }
.label-card button:hover { box-shadow: 0 10px 24px rgba(255, 255, 255, .15); }
.label-card button.soft { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .25); }
.label-card button.soft:hover { border-color: #fff; }
.label-card button:disabled { background: transparent; border: 1px dashed rgba(255, 255, 255, .25); color: rgba(255, 255, 255, .45); }
.saved { display: flex; gap: 8px; align-items: center; margin-top: 14px; padding: 10px 12px; border-radius: 10px; font-size: 13px; background: rgba(255, 255, 255, .1); animation: slideIn .35s var(--ease) both; }
.saved.err { background: rgba(180, 35, 24, .4); }
.saved a { color: #fff; font-weight: 600; }
.saved svg { width: 18px; height: 18px; flex: none; }
.res-body { padding: 6px 26px 26px; }
.res-body h3 { font-size: 11px; color: var(--muted); margin: 20px 0 8px; text-transform: uppercase; letter-spacing: .1em; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13px; }
.legend li { display: flex; gap: 10px; align-items: baseline; }
.legend b { font-family: 'JetBrains Mono', Consolas, monospace; padding: 2px 7px; border-radius: 6px; min-width: 58px; text-align: center; }
/* Части артикула различаются оттенками серого (на чёрной этикетке и в расшифровке) */
.c0, .c4 { background: #ffffff; color: #0a0a0a; }
.c1, .c5 { background: #d6d6d2; color: #0a0a0a; }
.c2, .c6 { background: #9c9c96; color: #0a0a0a; }
.c3, .c7 { background: #3d3d3a; color: #ffffff; }
.legend .c0, .legend .c4 { border: 1px solid var(--line-2); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 13px; background: var(--bad-soft); color: var(--bad); animation: slideIn .3s var(--ease) both; }
.checks li.ok { background: var(--ink); color: #fff; }
.checks svg { width: 18px; height: 18px; flex: none; }
.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv td:first-child { color: var(--muted); width: 45%; padding-right: 12px; }
.kv tr.new td:first-child::after { content: 'новое поле'; margin-left: 6px; font-size: 10px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--line-2); color: var(--muted); }
.namebox { font-size: 14px; line-height: 1.5; padding: 12px 14px; border-radius: 10px; background: var(--soft); }
.folder { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; color: #3a3a36; }
.folder svg { width: 16px; height: 16px; }
.notready { text-align: center; padding: 44px 20px; }
.notready .ico { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 16px; background: var(--soft); color: #a3a39c; display: grid; place-items: center; }
.notready p { color: var(--muted); max-width: 420px; margin: 8px auto 0; line-height: 1.5; }

/* ---------- История и пользователи: общее ---------- */
.hist-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.hist-head .sub { margin: 0; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; min-width: 130px; }
.stat b { display: block; font-size: 26px; letter-spacing: -.02em; }
.stat span { font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters label { margin: 0; flex: 1; min-width: 220px; }
.filters a.reset { font-size: 13px; padding: 11px 4px; color: var(--muted); }
.people { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.people a { text-decoration: none; font-size: 13px; padding: 7px 14px; border-radius: 20px; border: 1px solid var(--line-2); background: #fff; color: var(--text); transition: all .25s var(--ease); }
.people a:hover { border-color: var(--ink); transform: translateY(-1px); }
.people a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.people a i { font-style: normal; opacity: .55; margin-left: 5px; }
.hist { padding: 0; overflow: hidden; }
.hist table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hist th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 13px 18px; background: #fafaf8; border-bottom: 1px solid var(--line); }
.hist > table > tbody > tr > td, .hist > table > tr > td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; transition: background .2s; }
.hist tr.row { cursor: pointer; }
.hist tr.row:hover td, .hist tr:hover > td { background: #fafaf8; }
.hist .art { font-family: 'JetBrains Mono', Consolas, monospace; font-weight: 700; white-space: nowrap; }
.hist .muted { color: var(--muted); font-size: 13px; }
.hist .who { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.hist .who .avatar { width: 30px; height: 30px; font-size: 12px; background: var(--ink); color: #fff; }
.hist tr.more > td { background: #fafaf8; padding: 2px 18px 18px 18px; animation: fade .3s both; }
.hist tr.more .kv { max-width: 640px; }
.hist td.actions { text-align: right; white-space: nowrap; }
.hist td.actions form { display: inline; margin-left: 4px; }
.pill { display: inline-block; font-size: 12px; padding: 4px 11px; border-radius: 20px; background: var(--soft); color: #3a3a36; white-space: nowrap; font-weight: 500; }
.pill.ms, .pill.role-admin { background: var(--ink); color: #fff; }
.pill.role-manager { background: #fff; color: var(--ink); border: 1px solid var(--ink); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 14px; background: var(--soft); display: grid; place-items: center; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.role-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.role-card p { margin: 8px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ---------- Модальное окно ---------- */
dialog { border: 0; padding: 0; border-radius: 20px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
dialog[open] { animation: slideIn .35s var(--ease) both; }
dialog::backdrop { background: rgba(10, 10, 10, .45); backdrop-filter: blur(4px); animation: fade .3s both; }
.dlg-body { padding: 26px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.dlg-head h2 { margin: 0; font-size: 21px; letter-spacing: -.015em; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.pw { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.pw input { margin: 0; flex: 1; font-family: 'JetBrains Mono', Consolas, monospace; }
.role-pick { display: grid; gap: 8px; }
.role-pick label { margin: 0; cursor: pointer; }
.role-pick input { display: none; }
.role-pick span { display: block; padding: 12px 14px 12px 42px; border: 1px solid var(--line-2); border-radius: 12px; position: relative; transition: all .25s var(--ease); }
.role-pick span::before { content: ''; position: absolute; left: 14px; top: 15px; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-2); transition: all .25s var(--ease); }
.role-pick span:hover { border-color: var(--ink); }
.role-pick b { font-size: 14px; }
.role-pick small { margin-top: 2px; }
.role-pick input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.role-pick input:checked + span small { color: rgba(255, 255, 255, .65); }
.role-pick input:checked + span::before { border-color: #fff; background: #fff; box-shadow: inset 0 0 0 4px var(--ink); }

/* ---------- Логотип ---------- */
.brand-mark { background: none; width: 38px; height: 38px; border-radius: 0; }
.brand-mark .logo { width: 100%; height: 100%; display: block; border-radius: 10px; }
.logo .rays { transform-origin: 48.5px 48.5px; transition: transform .9s var(--ease); }
.brand:hover .logo .rays { transform: rotate(180deg); }
.brand:hover .brand-mark { transform: none; }
.login-hero .brand-mark { width: 52px; height: 52px; }
.login-hero .brand-mark .logo { border-radius: 14px; }
.login-hero .brand b { font-size: 20px; }
/* На странице входа лучи медленно вращаются постоянно — «включённая лампа» */
.login-hero .logo .rays { animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Фильтры истории ---------- */
.filter-card { padding: 20px 22px; margin-bottom: 18px; }
.filter-grid { display: grid; grid-template-columns: 2fr repeat(5, minmax(0, 1fr)); gap: 12px; }
.filter-grid label { margin: 0; }
@media (max-width: 1100px) { .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .filter-grid .search { grid-column: 1 / -1; } }
@media (max-width: 640px) { .filter-grid { grid-template-columns: 1fr; } }
.filter-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.quick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.quick .reset { color: var(--muted); font-size: 13px; margin-right: 6px; }
.quick .reset:hover { color: var(--ink); }
a.btn { text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--ink); transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0, 0, 0, .08); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn svg { width: 17px; height: 17px; }

/* Вид действия в таблице */
.act { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; padding: 5px 11px 5px 8px; border-radius: 20px; background: var(--soft); white-space: nowrap; }
.act svg { width: 15px; height: 15px; }
.act-article { background: var(--ink); color: #fff; }
.act-user_delete { background: var(--bad-soft); color: var(--bad); }
.act-login { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.hist .chev { width: 32px; text-align: right; color: var(--muted); font-size: 20px; }
.hist .chev span { display: inline-block; transition: transform .3s var(--ease); }
.hist tr.open .chev span { transform: rotate(90deg); }

/* ---------- Кнопка «На главную» ---------- */
.backbar { max-width: 1320px; margin: 0 auto; padding: 24px 32px 0; animation: fade .4s both; }
.backbar + .page { padding-top: 18px; }
.back { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px 8px 12px; border: 1px solid var(--line-2); border-radius: 30px; background: #fff; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; transition: all .3s var(--ease); }
.back span { display: inline-block; transition: transform .3s var(--ease); }
.back:hover { border-color: var(--ink); background: var(--ink); color: #fff; box-shadow: 0 8px 18px rgba(0, 0, 0, .12); }
.back:hover span { transform: translateX(-4px); }
.back:active { transform: scale(.96); }
.backbar { display: flex; gap: 8px; flex-wrap: wrap; }
button.back { border-radius: 30px; padding: 8px 16px 8px 12px; font-size: 13px; }
button.back b { font-weight: 600; }
.back[hidden] { display: none; }

/* ---------- Отгрузка ---------- */
.page.narrow { max-width: 820px; }
.page.narrow .card + .card { margin-top: 18px; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: 14px; background: var(--bad-soft); color: var(--bad); margin-bottom: 18px; font-size: 14px; line-height: 1.5; }
.banner.soft { background: #fff; color: var(--text); border: 1px dashed var(--line-2); }
.banner svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.banner a { color: inherit; font-weight: 600; }
.find-card { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.find-card label { margin: 0; min-width: 200px; }
.find-card .grow { flex: 1; }
.find-card #number { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 16px; letter-spacing: .02em; }
button.loading { pointer-events: none; opacity: .75; }
button.loading svg { animation: spin 1s linear infinite; }
#order { animation: rise .45s var(--ease) both; }
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 6px 0 14px; }
.order-head .cap { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.order-head h2 { margin: 4px 0; font-size: 26px; letter-spacing: -.02em; font-family: 'JetBrains Mono', Consolas, monospace; }
.money { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .money { grid-template-columns: 1fr 1fr; } }
.money .m { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; animation: rise .45s var(--ease) both; }
.money .m:nth-child(2) { animation-delay: .05s; } .money .m:nth-child(3) { animation-delay: .1s; } .money .m:nth-child(4) { animation-delay: .15s; }
.money span { font-size: 12px; color: var(--muted); }
.money b { display: block; font-size: 22px; letter-spacing: -.02em; margin-top: 2px; }
.money .dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.money .dark span { color: rgba(255, 255, 255, .6); }
.bar { position: relative; height: 10px; border-radius: 10px; background: var(--soft); margin: 14px 0 6px; overflow: hidden; }
.bar i { position: absolute; top: 0; bottom: 0; left: 0; width: 0; transition: width .5s var(--ease), left .5s var(--ease); }
.b-paid { background: #c9c9c4; }
.b-shipped { background: #6e6e68; }
.b-now { background: var(--ink); }
.b-now.over { background: var(--bad); }
.bar-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.bar-legend i { position: static; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--soft); border: 1px solid var(--line-2); }
.bar-legend i.b-paid { background: #c9c9c4; border: 0; }
.bar-legend i.b-shipped { background: #6e6e68; border: 0; }
.bar-legend i.b-now { background: var(--ink); border: 0; }
.positions { margin-bottom: 18px; }
.pos-tools { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.hist th.num, .hist td.num { text-align: right; white-space: nowrap; }
.hist td.num small { display: block; }
.positions tbody tr { animation: rise .4s var(--ease) both; }
.positions tr.done td { color: var(--muted); }
.positions td.low { color: var(--bad); font-weight: 600; }
.positions tr.bump td { animation: flashrow .5s ease; }
@keyframes flashrow { from { background: var(--soft); } to { background: transparent; } }
.stepper-in { display: inline-flex; align-items: center; gap: 4px; }
.stepper-in button { width: 32px; height: 32px; padding: 0; }
.stepper-in button i { font-style: normal; font-size: 16px; }
.stepper-in input { width: 70px; margin: 0; text-align: center; padding: 7px 6px; font-weight: 600; -moz-appearance: textfield; }
.stepper-in input::-webkit-outer-spin-button, .stepper-in input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper-in input.bad { border-color: var(--bad); color: var(--bad); animation: shake .3s; }
.ship-bar { position: sticky; bottom: 16px; z-index: 5; display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px 14px 18px; box-shadow: var(--shadow-up); }
.rules { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.rules li { display: flex; gap: 6px; align-items: center; font-size: 12px; padding: 6px 10px 6px 8px; border-radius: 10px; background: var(--soft); animation: fade .3s both; }
.rules li svg { width: 15px; height: 15px; flex: none; }
.rules li b { font-weight: 600; margin-right: 4px; }
.rules li small { display: inline; margin: 0; }
.rules li.bad { background: var(--bad-soft); color: var(--bad); }
.rules li.bad small { color: var(--bad); }
.rules li.warn { background: #fff; border: 1px dashed var(--line-2); }
.ship-total { display: flex; gap: 16px; align-items: center; }
.ship-total span { font-size: 12px; color: var(--muted); display: block; }
.ship-total b { font-size: 24px; letter-spacing: -.02em; display: block; }
.ship-total small { margin: 0; }
button.big { padding: 15px 22px; font-size: 15px; border-radius: 14px; }
dialog .center { text-align: center; }
.done-ico { width: 64px; height: 64px; border-radius: 50%; margin: 6px auto 14px; display: grid; place-items: center; animation: pop .5s var(--ease) both; }
.done-ico svg { width: 30px; height: 30px; stroke-width: 2.2; }
.done-ico.ok { background: var(--ink); color: #fff; }
.done-ico.bad { background: var(--bad-soft); color: var(--bad); }
#done h2 { margin: 0 0 8px; }
#done p { color: var(--muted); line-height: 1.5; }
.err-list { text-align: left; margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.err-list li { background: var(--bad-soft); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.dlg-foot.centered { justify-content: center; }
.warn-text { color: var(--bad); }

/* ---------- Склады в карточке пользователя ---------- */
.store-pick { display: flex; flex-wrap: wrap; gap: 8px; transition: opacity .2s; }
.store-pick.off { opacity: .35; pointer-events: none; }
.store-pick label { margin: 0; cursor: pointer; }
.store-pick input { display: none; }
.store-pick span { display: inline-block; padding: 7px 13px; border: 1px solid var(--line-2); border-radius: 20px; font-size: 13px; transition: all .25s var(--ease); }
.store-pick span:hover { border-color: var(--ink); }
.store-pick input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; animation: pop .3s var(--ease); }
dialog { max-height: calc(100vh - 32px); }

/* ---------- Настройки ---------- */
.status-line { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 14px 0 4px; padding: 12px 14px; border-radius: 12px; background: var(--soft); }
.status-line i { width: 10px; height: 10px; border-radius: 50%; background: #b5b5ae; }
.status-line.on i { background: var(--ink); box-shadow: 0 0 0 4px rgba(0, 0, 0, .1); animation: glow 2s infinite; }
.switch { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; }
.switch input { display: none; }
.switch .sw { flex: none; width: 44px; height: 26px; border-radius: 20px; background: var(--line-2); position: relative; transition: background .25s; margin-top: 2px; }
.switch .sw::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .3s var(--ease); }
.switch input:checked + .sw { background: var(--ink); }
.switch input:checked + .sw::after { transform: translateX(18px); }
.switch b { font-size: 14px; color: var(--text); }
.test-result { margin-top: 14px; padding: 12px 14px; border-radius: 12px; font-size: 14px; animation: slideIn .3s var(--ease) both; }
.test-result.ok { background: var(--ink); color: #fff; }
.test-result.bad { background: var(--bad-soft); color: var(--bad); }
.chips.static span { background: var(--soft); border-color: transparent; }

.act-demand { background: var(--ink); color: #fff; }
.act-demand_blocked { background: var(--bad-soft); color: var(--bad); }
.act-demand_check { background: #fff; border: 1px solid var(--ink); }

/* Отгрузка на телефоне: таблица прокручивается вбок, панель итогов не «прилипает» */
.positions { overflow-x: auto; }
.positions table { min-width: 760px; }
@media (max-width: 760px) {
  .ship-bar { position: static; }
  .rules li { width: 100%; }
  .ship-total { width: 100%; justify-content: space-between; }
  .order-head { flex-direction: column; align-items: flex-start; }
}
.rules:empty { display: none; }
.ship-bar:has(.rules:empty) { justify-content: flex-end; }

/* Проверка на дубли */
#dups:not(:empty) { margin-bottom: 6px; }
.checks li.pending { background: var(--soft); color: var(--muted); }
.checks li.pending svg { animation: glow 1s infinite; }
.checks li.warn { background: #fff; color: var(--text); border: 1px dashed var(--line-2); }
.checks li small { display: block; margin-top: 3px; color: inherit; opacity: .8; }
.checks li a { color: inherit; font-weight: 600; }
.checks li[hidden] { display: none; }

/* Скрытые элементы всегда скрыты, даже если у класса задан display */
[hidden] { display: none !important; }

/* =====================================================================
   МОБИЛЬНАЯ ВЕРСИЯ
   Всё, что ниже, включается только на узких экранах (телефон, планшет).
   ===================================================================== */

/* Бургер и выезжающее меню: на компьютере скрыты */
.burger, .mnav, .mbar { display: none; }

@media (max-width: 860px) {
  /* ---------- Шапка: логотип слева, бургер справа ---------- */
  .top { padding: 0 16px; height: 58px; gap: 12px; }
  .topnav, .top .user { display: none; }
  .brand span { display: none; }
  .brand b { font-size: 15px; }
  .burger { display: inline-flex; flex-direction: column; justify-content: center; gap: 5px; margin-left: auto; width: 42px; height: 42px; padding: 0 10px; background: transparent; border: 1px solid rgba(255, 255, 255, .2); border-radius: 12px; }
  .burger:hover { transform: none; box-shadow: none; background: rgba(255, 255, 255, .08); }
  .burger span { display: block; height: 2px; width: 100%; background: #fff; border-radius: 2px; transition: transform .3s var(--ease), opacity .2s; }
  .menu-open .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-open .burger span:nth-child(2) { opacity: 0; }
  .menu-open .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .mnav { display: flex; flex-direction: column; position: fixed; top: 58px; left: 0; right: 0; z-index: 40; background: #0a0a0a; padding: 8px 12px 16px; border-radius: 0 0 20px 20px; box-shadow: 0 24px 48px rgba(0, 0, 0, .35);
    transform: translateY(-12px); opacity: 0; pointer-events: none; transition: transform .3s var(--ease), opacity .25s; }
  .menu-open .mnav { transform: none; opacity: 1; pointer-events: auto; }
  .menu-open::after { content: ''; position: fixed; inset: 58px 0 0 0; z-index: 30; background: rgba(10, 10, 10, .4); backdrop-filter: blur(3px); animation: fade .25s both; }
  .mnav-user { display: flex; gap: 12px; align-items: center; color: #fff; padding: 10px 8px 14px; border-bottom: 1px solid rgba(255, 255, 255, .1); margin-bottom: 6px; }
  .mnav-user span { display: block; font-size: 12px; opacity: .55; }
  .mnav a { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-size: 16px; padding: 13px 10px; border-radius: 12px; opacity: .8; transition: background .2s, opacity .2s; }
  .mnav a svg { width: 20px; height: 20px; }
  .mnav a:hover, .mnav a.on { opacity: 1; background: rgba(255, 255, 255, .1); }
  .mnav a.out { margin-top: 6px; border-top: 1px solid rgba(255, 255, 255, .1); border-radius: 0; opacity: .55; }

  .flashes { top: 70px; left: 12px; right: 12px; }
}

@media (max-width: 760px) {
  /* ---------- Общее: меньше отступы и заголовки ---------- */
  .page { padding: 18px 16px 48px; }
  .backbar { padding: 16px 16px 0; }
  .backbar + .page { padding-top: 12px; }
  h1 { font-size: 24px; }
  .sub { margin-bottom: 18px; font-size: 14px; }
  .card { padding: 18px; border-radius: 14px; }
  /* 16px в полях ввода — иначе iPhone приближает страницу при нажатии на поле */
  input, select { font-size: 16px; padding: 12px; }
  .grid2 { grid-template-columns: 1fr; }
  button { padding: 12px 16px; }
  .dlg-foot { flex-direction: column-reverse; }
  .dlg-foot button { width: 100%; }
  dialog { width: calc(100vw - 24px); border-radius: 18px; }
  .dlg-body { padding: 20px 18px; }
  .pw { flex-wrap: wrap; }
  .pw input { flex-basis: 100%; }

  /* ---------- Главная: плитки во всю ширину ---------- */
  .tiles.big { grid-template-columns: 1fr; }
  .tiles.big .tile { padding: 20px; min-height: 0; }
  .tiles.big .tile .ico { width: 48px; height: 48px; }
  .tiles.big .tile b { font-size: 18px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 16px; gap: 8px; }
  .tile span { font-size: 12px; padding-right: 0; }
  .tile::after { display: none; }
  .tile .ico { width: 40px; height: 40px; }

  /* ---------- Создание артикула ---------- */
  .stepper { gap: 6px; }
  .step { font-size: 12px; padding: 5px 11px 5px 5px; }
  .step i { width: 20px; height: 20px; font-size: 11px; }
  #result { position: static; }
  .article { font-size: 19px; }
  .label-card { padding: 20px; }
  .label-card .row button { flex: 1 1 100%; }
  .res-body { padding: 4px 18px 18px; }
  .chips span { padding: 9px 14px; }
  /* Нижняя панель с артикулом: всегда видно, что получается */
  .mbar { position: sticky; bottom: 12px; z-index: 20; display: flex; align-items: center; gap: 10px; margin: 18px 0 0; padding: 12px 14px; border-radius: 16px; background: #0a0a0a; color: #fff; text-decoration: none; box-shadow: 0 16px 36px rgba(0, 0, 0, .3); animation: rise .4s var(--ease) both; }
  .mbar span { flex: 1; min-width: 0; }
  .mbar small { display: block; margin: 0; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: rgba(255, 255, 255, .5); }
  .mbar b { display: block; font-family: 'JetBrains Mono', Consolas, monospace; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mbar i { width: 10px; height: 10px; border-radius: 50%; background: #fff; flex: none; }
  .mbar.bad i, .mbar.dup i { background: #ff6b5e; }
  .mbar em { font-style: normal; font-size: 13px; opacity: .7; white-space: nowrap; }

  /* ---------- Таблицы → карточки ---------- */
  .hist > table, .hist > table > tbody, .hist > table > tbody > tr, .hist > table > tbody > tr > td,
  .hist > table > thead, .hist > table > thead > tr { display: block; width: 100%; }
  .hist > table > tbody > tr:has(> th), .hist > table > thead { display: none; }
  .hist > table > tbody > tr > td { border: 0; padding: 0; }
  .hist > table > tbody > tr { border-bottom: 1px solid var(--line); padding: 14px 16px; }
  .hist tr.row:hover td, .hist tr:hover > td { background: transparent; }

  /* История: [действие ........ дата] / [кто] / [подробности] */
  .hist > table > tbody > tr:has(> .c-act) { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'act date' 'who who' 'det det'; gap: 8px 10px; align-items: center; }
  .c-act { grid-area: act; }
  .c-date { grid-area: date; text-align: right; font-size: 12px; }
  .c-who { grid-area: who; }
  .c-det { grid-area: det; }
  .c-det:empty, .c-chev { display: none !important; }
  .hist .c-det .art { white-space: normal; word-break: break-all; }
  .hist tr.open { border-bottom: 0; }
  .hist tr.more > td { padding: 0 0 6px; }
  .hist tr.more { padding: 0 16px 14px; background: #fafaf8; }
  .hist tr.more .kv td:first-child { width: 42%; }

  /* Пользователи: [кто ..... кнопки] / [логин роль] / [склады] */
  .hist > table > tbody > tr:has(> .c-login) { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: 'who who actions' 'login role role' 'stores stores stores'; gap: 8px 10px; align-items: center; }
  .c-who { grid-area: who; }
  .c-login { grid-area: login; }
  .c-role { grid-area: role; }
  .c-stores { grid-area: stores; }
  .c-actions { grid-area: actions; }

  /* Отгрузка: карточка позиции с цифрами в ряд и полем количества */
  .positions table { min-width: 0; }
  .positions { overflow: visible; }
  .positions > table > tbody > tr { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-areas: 'name name name name' 'n1 n2 n3 n4' 'price qty qty sum'; gap: 10px 8px; }
  .positions .c-name { grid-area: name; }
  .positions td.num { text-align: left; }
  .positions td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
  .positions .c-n { background: var(--soft); border-radius: 10px; padding: 7px 9px !important; }
  .positions .c-price { grid-area: price; align-self: center; }
  .positions .c-qty { grid-area: qty; align-self: center; text-align: center !important; }
  .positions .c-sum { grid-area: sum; align-self: center; text-align: right !important; }
  .positions tr.done .c-qty { color: var(--muted); }
  .stepper-in button { width: 40px; height: 40px; }
  .stepper-in input { width: 64px; padding: 9px 4px; }
  .pos-tools { flex-wrap: wrap; gap: 10px; }
  .find-card { flex-direction: column; align-items: stretch; }
  .find-card label { min-width: 0; }
  .order-head h2 { font-size: 21px; }
  .money { gap: 8px; }
  .money .m { padding: 12px 14px; }
  .money b { font-size: 19px; }
  .ship-bar { padding: 14px; gap: 12px; }
  .ship-total { flex-direction: column; align-items: stretch; gap: 10px; }
  .ship-total button { width: 100%; }

  /* ---------- История: фильтры компактнее ---------- */
  .stats { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { min-width: 0; padding: 10px 14px; }
  .stat b { font-size: 21px; }
  .filter-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .filter-grid .search { grid-column: 1 / -1; }
  .filter-foot { flex-direction: column; align-items: stretch; }
  .filter-foot .quick { justify-content: space-between; }
  .filter-foot .quick:last-child { flex-direction: column-reverse; align-items: stretch; }
  .filter-foot .quick:last-child > * { width: 100%; justify-content: center; text-align: center; }
  .hist-head { margin-bottom: 14px; }
  .hist-head > button { width: 100%; }
  .roles { grid-template-columns: 1fr; }

  /* Вход */
  .login-side { padding: 24px 20px; align-items: start; padding-top: 12vh; }
}
@media (max-width: 760px) and (min-width: 0) {
  /* На входе показываем логотип над формой (левая тёмная половина на телефоне скрыта) */
  .login-card::before { content: ''; display: block; width: 56px; height: 56px; margin-bottom: 22px; border-radius: 14px; background: url('logo.svg') center / cover; box-shadow: 0 8px 20px rgba(0, 0, 0, .12); }
}

/* Мобильная версия: исправления после проверки */
@media (max-width: 860px) {
  .menu-open::after { z-index: 10; }   /* затемнение — под шапкой и меню, а не поверх */
}
@media (max-width: 760px) {
  .filter-grid > * { min-width: 0; }   /* поля фильтров не вылезают за карточку */
  .card.hist { padding: 0; }
}

/* Обязательные поля — звёздочка перед названием */
[data-field][data-req="1"]::before { content: '* '; color: var(--bad); font-weight: 700; }

/* ---------- Товар без артикула (b2b) ---------- */
textarea { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font: inherit; font-size: 15px; line-height: 1.45; color: var(--text); background: #fff;
  border: 1px solid var(--line-2); border-radius: 10px; resize: vertical; transition: border-color .2s, box-shadow .2s; }
textarea:hover { border-color: #a9a9a3; }
textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(0, 0, 0, .07); }
.similar { margin: 10px 0 4px; padding: 14px 16px; border: 1px dashed var(--line-2); border-radius: 12px; animation: slideIn .3s var(--ease) both; }
.similar .cap { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.similar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.similar li { font-size: 14px; line-height: 1.4; }
.similar li small { display: block; margin-top: 2px; }
.similar a { color: var(--ink); font-weight: 600; }
@media (max-width: 760px) { textarea { font-size: 16px; } }
.pill.role-b2b { background: #fff; color: var(--ink); border: 1px solid var(--ink); }

/* ---------- Фото товара ---------- */
.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-list { display: contents; }
.photo { position: relative; width: 108px; height: 108px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--soft); animation: pop .3s var(--ease) both; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; padding: 0; border-radius: 50%; font-size: 12px; background: rgba(10, 10, 10, .75); border: 0; }
.photo-add { width: 108px; height: 108px; margin: 0; border: 1.5px dashed var(--line-2); border-radius: 12px; display: grid; place-items: center; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.photo-add:hover { border-color: var(--ink); background: #fafaf8; }
.photo-add span { display: grid; justify-items: center; gap: 2px; font-size: 12px; }
.photo-add small { font-size: 10px; margin: 0; }
.req-star { color: var(--bad); }

/* ---------- Номер модели декора ---------- */
.model-info { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin: -4px 0 8px; padding: 9px 12px; border-radius: 10px; background: var(--soft); }
.model-info b { color: var(--ink); font-size: 15px; }
.model-info a { color: var(--ink); font-weight: 600; }
.model-info:empty { display: none; }
input[readonly] { cursor: default; }

/* ---------- Главные кнопки «Создать в МойСклад» / «Создать отгрузку» — зелёные ---------- */
:root { --go: #16a34a; --go-2: #12863d; }
button#create, button#ship, .label-card button#create { background: var(--go); border-color: var(--go); color: #fff; }
button#create:hover, button#ship:hover, .label-card button#create:hover { background: var(--go-2); border-color: var(--go-2); box-shadow: 0 10px 22px rgba(22, 163, 74, .3); }
/* Пока нажимать нельзя — серая, как остальные неактивные кнопки */
button#create:disabled, button#ship:disabled { background: #d9d9d5; border-color: #d9d9d5; color: #fff; box-shadow: none; }
.label-card button#create:disabled { background: transparent; border: 1px dashed rgba(255, 255, 255, .25); color: rgba(255, 255, 255, .45); }

/* Окно «Фото товара» перед созданием карточки */
#photo-dlg .pd-what { margin: 4px 0 10px; line-height: 1.5; }
#photo-dlg .pd-what b { font-family: 'JetBrains Mono', Consolas, monospace; color: var(--ink); font-size: 15px; }
#photo-dlg .pd-hint { font-size: 14px; color: #3a3a36; line-height: 1.5; margin: 0 0 14px; }
#photo-dlg .dlg-foot { flex-wrap: wrap; }
#pd-with:not(:disabled) { background: var(--go); border-color: var(--go); }
#pd-with:not(:disabled):hover { background: var(--go-2); border-color: var(--go-2); }
#pd-without { margin-right: auto; }

.act-salesreturn { background: var(--ink); color: #fff; }
.act-return_blocked { background: var(--bad-soft); color: var(--bad); }
.act-return_check { background: #fff; border: 1px solid var(--ink); }

/* ---------- Возврат покупателя ---------- */
.demand-pick { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.demand-pick label { margin: 0; cursor: pointer; }
.demand-pick input { display: none; }
.demand-pick span { display: block; padding: 12px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; transition: all .25s var(--ease); }
.demand-pick span b { font-family: 'JetBrains Mono', Consolas, monospace; }
.demand-pick span small { margin-top: 2px; }
.demand-pick input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.demand-pick input:checked + span small { color: rgba(255, 255, 255, .65); }
.reason { margin: 0 0 18px; }

/* ---------- Вход через Битрикс24 ---------- */
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.bx-btn { display: flex; width: 100%; padding: 13px; margin-top: 6px; border: 1px solid #2fc6f6; color: #0b7fb0; }
.bx-btn:hover { background: #eefaff; border-color: #1ab5e8; }
.pill.bx { background: #eefaff; color: #0b7fb0; margin-left: 6px; font-size: 11px; }
.pill.role-none { background: var(--bad-soft); color: var(--bad); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.empty p { margin: 6px 0 0; }
