@font-face { font-family: "Onest"; src: url("../fonts/onest-cyrillic.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; src: url("../fonts/onest-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+00D7; }

:root {
  --page: #F7F8FA;
  --panel: #FFFFFF;
  --ink: #0B1220;
  --ink-2: #4B5565;
  --ink-3: #8A94A6;
  --line: #E4E7EC;
  --line-2: #EEF0F3;
  --hover: #F4F6F9;
  --accent: #2B50E8;
  --accent-dark: #1F3FC4;
  --accent-tint: #EEF2FE;
  --accent-soft: #DCE4FD;
  --accent-ring: rgba(43,80,232,.18);

  --pending: #B54708;   --pending-bg: #FFF4E5;
  --approved: #067647;  --approved-bg: #ECFDF3;
  --corrected: #175CD3; --corrected-bg: #EFF8FF;
  --rejected: #B42318;  --rejected-bg: #FEF3F2;
  --cancelled: #475467; --cancelled-bg: #F2F4F7;

  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --r-sm: 8px; --r-md: 12px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --t-fast: 120ms; --t-med: 200ms; --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 15px/1.5 "Onest", system-ui, sans-serif; color: var(--ink); background: var(--page);
  font-feature-settings: "tnum" 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); color: var(--ink-2); padding: var(--s5) var(--s3);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--s5); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2); color: var(--ink); font-weight: 700; font-size: 16px;
  letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand svg { flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 12px; font-weight: 500; color: var(--ink-3); padding: var(--s4) var(--s3) var(--s1); }
.nav a { display: flex; align-items: center; gap: var(--s3); padding: 8px var(--s3); border-radius: var(--r-sm); color: var(--ink-2);
  font-weight: 500; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.nav a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-tint); color: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
  border-radius: 999px; padding: 0 7px; line-height: 20px; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s2) 0;
  border-top: 1px solid var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-tint); color: var(--accent); display: grid;
  place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.side-user .who { min-width: 0; flex: 1; font-size: 13px; line-height: 1.3; color: var(--ink-3); }
.side-user .who b { display: block; color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user button { background: none; border: 0; color: var(--ink-3); cursor: pointer; padding: 6px; border-radius: var(--r-sm); }
.side-user button:hover { color: var(--ink); background: var(--hover); }

.topbar { display: none; }
.main { padding: var(--s6) var(--s6) var(--s7); min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-head .sub { margin-top: var(--s1); color: var(--ink-2); }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.crumb { font-size: 13px; color: var(--ink-2); margin-bottom: var(--s2); display: inline-block; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.panel + .panel, .panel + .grid, .grid + .panel { margin-top: var(--s5); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-body { padding: var(--s5); }
.grid { display: grid; gap: var(--s5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }

/* figures strip: one panel, divided — not a row of cards */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  border-radius: var(--r-md); margin-bottom: var(--s5); }
.figure { padding: var(--s4) var(--s5); border-left: 1px solid var(--line-2); }
.figure:first-child { border-left: 0; }
.figure .label { font-size: 13px; color: var(--ink-2); }
.figure .value { font-size: 24px; font-weight: 600; margin-top: 2px; letter-spacing: -.01em; }
.figure .value small { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.figure .hint { font-size: 13px; color: var(--ink-3); }
.figure a.value { display: block; color: var(--ink); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-2); padding: 10px var(--s4); border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--hover); }
.t td { padding: 11px var(--s4); border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover td { background: var(--hover); }
.t tr.is-selected td { background: var(--accent-tint); }
.t .check { width: 40px; padding-right: 0; }
.t tfoot td { font-weight: 600; border-top: 1px solid var(--line); background: var(--hover); }
.row-link { color: var(--ink); font-weight: 500; }
.cell-product { display: flex; align-items: center; gap: var(--s3); min-width: 180px; }
.thumb { width: 40px; height: 52px; border-radius: 4px; object-fit: cover; background: var(--line-2); flex: none; }
.thumb-empty { display: grid; place-items: center; color: var(--ink-3); }

.empty { padding: var(--s7) var(--s5); text-align: center; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: var(--s1); }
.empty .btn { margin-top: var(--s4); }

/* ---------- status ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; padding: 2px 10px 2px 8px;
  border-radius: 999px; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pending { color: var(--pending); background: var(--pending-bg); }
.status-approved { color: var(--approved); background: var(--approved-bg); }
.status-corrected { color: var(--corrected); background: var(--corrected-bg); }
.status-rejected { color: var(--rejected); background: var(--rejected-bg); }
.status-cancelled { color: var(--cancelled); background: var(--cancelled-bg); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 4px; background: var(--line-2); color: var(--ink-2); }

/* ---------- tabs & filters ---------- */
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); overflow-x: auto; }
.tabs a { padding: var(--s2) var(--s3); color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.tabs .count { font-size: 12px; color: var(--ink-3); margin-left: 4px; }
.filters { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.filters .input, .filters select { width: auto; min-width: 160px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: 38px; padding: 0 var(--s4);
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit;
  font-weight: 500; cursor: pointer; white-space: nowrap; transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.btn:hover { background: var(--hover); border-color: #CDD2DA; text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-approve { color: var(--approved); }
.btn-approve:hover { background: var(--approved-bg); border-color: #ABEFC6; }
.btn-danger { color: var(--rejected); }
.btn-danger:hover { background: var(--rejected-bg); border-color: #FECDCA; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 38px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- forms ---------- */
.form { display: grid; gap: var(--s4); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.field .help { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.field .error { font-size: 13px; color: var(--rejected); margin-top: 4px; }
.input, .field input[type=text], .field input[type=number], .field input[type=date], .field input[type=month],
.field input[type=password], .field input[type=tel], .field select, .field textarea, select.input {
  width: 100%; height: 40px; padding: 0 var(--s3); border: 1px solid var(--line); border-radius: var(--r-sm); font: inherit;
  color: var(--ink); background: #fff; transition: border-color var(--t-fast) var(--ease); }
.field textarea { height: auto; min-height: 88px; padding: var(--s2) var(--s3); resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus, select.input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--rejected); }
.check-field { display: flex; gap: var(--s3); align-items: flex-start; }
.check-field input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--accent); }
.check-field label { margin: 0; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.form-actions { display: flex; gap: var(--s2); padding-top: var(--s2); }
.form-errors { background: var(--rejected-bg); color: var(--rejected); padding: var(--s3) var(--s4); border-radius: var(--r-sm); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 15px; margin-bottom: var(--s3); padding: 0; }

/* ---------- selection bar ---------- */
.selbar { position: fixed; bottom: var(--s5); left: calc(236px + var(--s6)); right: var(--s6); z-index: 25; display: flex; align-items: center; gap: var(--s3);
  background: var(--ink); color: #fff; padding: var(--s2) var(--s2) var(--s2) var(--s4); border-radius: var(--r-md);
  transform: translateY(8px); opacity: 0; pointer-events: none; transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease); }
.selbar.show { transform: none; opacity: 1; pointer-events: auto; }
.selbar .grow { flex: 1; }
.selbar .btn { border-color: #2A3447; background: #1A2233; color: #fff; }
.selbar .btn:hover { background: #252F44; }
.selbar .btn-primary { background: var(--approved); border-color: var(--approved); }

/* ---------- tier ladder (the one memorable thing) ---------- */
.ladder { display: flex; gap: 3px; align-items: flex-end; min-width: 120px; }
.ladder .step { flex: 1; background: var(--line-2); border-radius: 2px; position: relative; overflow: hidden; }
.ladder .step i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.ladder-sm .step { height: 8px; }

.stair { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 200px; }
.stair .tread { position: relative; border-radius: 4px 4px 0 0; background: var(--line-2); display: flex; flex-direction: column;
  justify-content: flex-end; overflow: hidden; }
.stair .tread .fill { position: absolute; inset: auto 0 0 0; background: var(--accent-soft); height: 0; transition: height 600ms var(--ease); }
.stair .tread.reached .fill { height: 100%; }
.stair .tread.current { box-shadow: inset 0 3px 0 var(--accent); }
.stair .tread.current .fill { background: var(--accent-soft); }
.stair .tread .lbl { position: relative; padding: var(--s3); font-size: 13px; line-height: 1.35; }
.stair .tread .lbl b { display: block; font-size: 16px; }
.stair-meta { display: flex; justify-content: space-between; gap: var(--s4); margin-top: var(--s4); flex-wrap: wrap; }
.big-num { font-size: 40px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }

/* ---------- history timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 var(--s4) var(--s5); }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -4px; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 1px; top: 6px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--ink-3); }
.timeline li.ev-approved::after { border-color: var(--approved); }
.timeline li.ev-corrected::after { border-color: var(--corrected); }
.timeline li.ev-rejected::after, .timeline li.ev-cancelled::after { border-color: var(--rejected); }
.timeline .when { font-size: 13px; color: var(--ink-3); }
.change { display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; font-size: 14px; margin-top: 4px; }
.change .old { color: var(--rejected); text-decoration: line-through; }
.change .new { color: var(--approved); font-weight: 500; }
.reason { margin-top: 6px; padding: var(--s2) var(--s3); background: var(--hover); border-radius: var(--r-sm); font-size: 14px; }

dl.props { display: grid; grid-template-columns: 150px 1fr; gap: var(--s2) var(--s4); margin: 0; }
dl.props dt { color: var(--ink-2); }
dl.props dd { margin: 0; }

/* ---------- dialog ---------- */
dialog { border: 0; border-radius: var(--r-md); padding: 0; width: min(460px, calc(100vw - 32px)); color: var(--ink);
  box-shadow: 0 24px 64px rgba(11,18,32,.28); }
dialog::backdrop { background: rgba(11,18,32,.45); }
dialog[open] { animation: dlg-in var(--t-med) var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px) scale(.99); } }
dialog .dlg-head { padding: var(--s5) var(--s5) 0; }
dialog .dlg-body { padding: var(--s4) var(--s5); }
dialog .dlg-foot { padding: 0 var(--s5) var(--s5); display: flex; justify-content: flex-end; gap: var(--s2); }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: var(--s4); right: var(--s4); display: grid; gap: var(--s2); z-index: 50; }
.toast { background: var(--ink); color: #fff; padding: var(--s3) var(--s4); border-radius: var(--r-sm); max-width: 380px;
  box-shadow: 0 8px 24px rgba(11,18,32,.2); animation: dlg-in var(--t-med) var(--ease); }
.toast.error { background: var(--rejected); }
.toast.warning { background: var(--pending); }

/* ---------- catalog editing ---------- */
.size-rows { display: grid; gap: var(--s2); }
.size-row { display: grid; grid-template-columns: 1fr 1fr 1.3fr 40px 76px; gap: var(--s2); align-items: center; }
.size-row.head { font-size: 13px; color: var(--ink-2); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--s3); }
.photo-tile { position: relative; aspect-ratio: 3 / 4; border-radius: var(--r-sm); overflow: hidden; background: var(--line-2); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-add { border: 1px dashed #CDD2DA; display: grid; place-items: center; text-align: center; color: var(--ink-2); font-size: 13px;
  cursor: pointer; padding: var(--s3); background: var(--hover); }
.photo-add:hover { border-color: var(--accent); color: var(--accent); }
.photo-add input { display: none; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s5) var(--s4); }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: var(--s6); }
.login-head { display: grid; justify-items: center; text-align: center; gap: var(--s2); margin-bottom: var(--s2); }
.login-head h1 { margin: var(--s2) 0 0; }
.login-head p { margin: 0; }
.login-card .btn { width: 100%; justify-content: center; }
@media (max-width: 420px) { .login-card { padding: var(--s5) var(--s4); } }

@media (max-width: 1100px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure:nth-child(3) { border-left: 0; }
  .figure:nth-child(n+3) { border-top: 1px solid var(--line-2); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%);
    transition: transform var(--t-med) var(--ease); }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(11,18,32,.45); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--panel); color: var(--ink); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20; }
  .topbar button { background: none; border: 0; color: var(--ink); width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; }
  .main { padding: var(--s5) var(--s4) var(--s7); }
  .grid-2, .form-row, .form-row-3 { grid-template-columns: 1fr; }
  dl.props { grid-template-columns: 1fr; gap: 0; }
  dl.props dd { margin-bottom: var(--s2); }
  .size-row { grid-template-columns: 1fr 1fr; }
  .stair { height: 160px; }
}
@media (max-width: 520px) {
  .figures { grid-template-columns: 1fr; }
  .figure { border-left: 0; border-top: 1px solid var(--line-2); }
  .figure:first-child { border-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .side, .topbar, .no-print { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; }
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.t th.right, .t td.right { text-align: right; }
.grid > .panel, .grid > div > .panel:first-child { margin-top: 0; }
@media (max-width: 860px) { .selbar { left: var(--s4); right: var(--s4); bottom: var(--s4); } }
.t-compact th, .t-compact td { padding: 8px 12px; }

/* tables that turn into stacked rows on phones */
@media (max-width: 640px) {
  .t-stack thead { display: none; }
  .t-stack, .t-stack tbody, .t-stack tr, .t-stack td { display: block; width: 100%; }
  .t-stack tr { position: relative; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line-2); }
  .t-stack tr:last-child { border-bottom: 0; }
  .t-stack td { border: 0; padding: 2px 0; text-align: left; display: flex; gap: var(--s3); align-items: baseline; }
  .t-stack td.right { text-align: left; }
  .t-stack td[data-label]::before { content: attr(data-label); flex: 0 0 84px; color: var(--ink-3); font-size: 13px; }
  .t-stack td.check { position: absolute; right: var(--s4); top: var(--s3); width: auto; }
  .t-stack td.row-actions { padding-top: var(--s2); justify-content: flex-start; gap: var(--s2); }
  .t-stack tbody tr:hover td { background: none; }
  .t-stack .btn-sm { height: 38px; min-width: 44px; }
}
input[type=radio] { accent-color: var(--accent); }
.stair .tread.current .lbl b { color: var(--accent); }
.btn { box-shadow: var(--shadow-sm); }
.btn-ghost, .selbar .btn { box-shadow: none; }
.btn-primary:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---------- right-side drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(11,18,32,.28); opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity var(--t-med) var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 100vw); background: var(--panel);
  border-left: 1px solid var(--line); box-shadow: -16px 0 48px rgba(11,18,32,.12); z-index: 61; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 240ms var(--ease); visibility: hidden; }
body.drawer-open { overflow: hidden; }
body.drawer-open .drawer { transform: none; visibility: visible; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer-progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; opacity: 0; }
.drawer.loading .drawer-progress { opacity: 1; }
.drawer-progress::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent);
  animation: dw-load 900ms var(--ease) infinite; }
@keyframes dw-load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.drawer-content { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.dw-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); padding: var(--s5) var(--s5) var(--s4);
  border-bottom: 1px solid var(--line); }
.dw-head h2 { font-size: 20px; }
.dw-head .sub { margin-top: 6px; color: var(--ink-2); font-size: 14px; display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.dw-body { flex: 1; overflow-y: auto; padding: var(--s5); display: grid; gap: var(--s4); align-content: start; }
.dw-foot { padding: var(--s4) var(--s5); border-top: 1px solid var(--line); display: flex; gap: var(--s2); flex-wrap: wrap;
  align-items: center; background: var(--panel); }
.dw-foot .grow { flex: 1; }
.dw-close { flex: none; width: 36px; height: 36px; border-radius: var(--r-sm); border: 0; background: none; color: var(--ink-3);
  display: grid; place-items: center; cursor: pointer; }
.dw-close:hover { background: var(--hover); color: var(--ink); }
.dw-section h3 { font-size: 14px; color: var(--ink-2); font-weight: 500; margin-bottom: var(--s2); }
.dw-receipt img { width: 100%; max-height: 420px; object-fit: contain; background: var(--hover); border-radius: var(--r-sm);
  border: 1px solid var(--line); }
.dw-reject { display: grid; gap: var(--s2); padding: var(--s4); background: var(--rejected-bg); border-radius: var(--r-sm); }
.dw-reject[hidden] { display: none; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-sm); }
.facts > div { padding: var(--s3) var(--s4); border-left: 1px solid var(--line); }
.facts > div:first-child { border-left: 0; }
.facts .label { font-size: 12px; color: var(--ink-3); }
.facts .value { font-size: 18px; font-weight: 600; }
kbd { font: 500 11px/1 "Onest", system-ui, sans-serif; padding: 3px 5px; border-radius: 4px; border: 1px solid currentColor;
  opacity: .55; margin-left: 2px; }
.btn-primary kbd { border-color: rgba(255,255,255,.6); opacity: .8; }
/* drawer fragments opened as a normal page */
.drawer-page { max-width: 680px; }
.drawer-page .dw-close { display: none; }
.drawer-page .dw-body { overflow: visible; }
tr[data-drawer-url] { cursor: pointer; }
@media (max-width: 640px) {
  .dw-head, .dw-body { padding-left: var(--s4); padding-right: var(--s4); }
  .dw-foot { padding: var(--s3) var(--s4); }
  .facts > div { padding: var(--s2) var(--s3); }
  .facts .value { font-size: 16px; }
  kbd { display: none; }
}
tr.is-open > td { background: var(--accent-tint); }
tr[data-drawer-url]:hover > td { background: var(--hover); }
tr.is-open:hover > td { background: var(--accent-tint); }
.dw-tools { display: flex; gap: 2px; flex: none; }
.dw-tools a.dw-close:hover { text-decoration: none; }

/* ---------- tariff ---------- */
.tier-badge { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-tint);
  color: var(--accent); font-size: 12px; font-weight: 600; flex: none; }
.tariff-explain { border-top: 1px solid var(--line); display: grid; gap: var(--s2); }
.tariff-explain > * { max-width: 760px; }
.tariff-explain h3 { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.tariff-formula { font-size: 20px; }
.tier-line { display: flex; justify-content: space-between; gap: var(--s3); padding: 3px 0; }
.tariff-old { padding-bottom: var(--s3); margin-bottom: var(--s3); border-bottom: 1px solid var(--line-2); }
.tariff-old:last-of-type { border-bottom: 0; }
.planned { border-color: var(--accent-soft); }
.tiers { display: grid; gap: var(--s2); }
.tier-row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.tier-row .input { width: 96px; }
.tier-row input[name=amount] { width: 120px; }
.tier-from { min-width: 78px; white-space: nowrap; }
.tier-unit { color: var(--ink-2); white-space: nowrap; }
.tier-open { display: none; width: 96px; color: var(--ink-2); }
.tier-row.is-last input[name=max], .tier-row.is-last .tier-to { display: none; }
.tier-row.is-last .tier-open { display: inline; }
.tier-row [data-tier-remove] { width: 32px; height: 32px; margin-left: auto; }
.tier-row [data-tier-remove][hidden] { display: none; }
fieldset.dw-section { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.dw-section legend { padding: 0; margin-bottom: var(--s2); }
.tariff-calc { background: var(--hover); border-radius: var(--r-sm); padding: var(--s4); display: grid; gap: var(--s2); }
.tariff-calc label { font-weight: 500; }
.tariff-calc-row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
@media (max-width: 640px) {
  .tier-row { padding-bottom: var(--s2); border-bottom: 1px solid var(--line-2); row-gap: 6px; }
  .tier-row [data-tier-remove] { order: -1; margin-left: 0; }
}
.tariff-help { font-size: 13px; color: var(--ink-3); margin-top: 8px; }
.choices { display: grid; gap: var(--s2); }
.choice { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid var(--line);
  border-radius: var(--r-sm); cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.choice:hover { border-color: #CDD2DA; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.choice input { margin-top: 3px; accent-color: var(--accent); flex: none; }
.choice > span { display: grid; gap: 2px; }
.diff-up { color: var(--approved); }
.diff-down { color: var(--rejected); }
[data-impact][hidden] { display: none; }
.tariff-note { color: var(--ink-2); font-size: 14px; }
.tariff-impact { border: 1px solid var(--accent-soft); background: var(--accent-tint); border-radius: var(--r-sm); padding: var(--s3) var(--s4);
  display: grid; gap: var(--s2); }
.tariff-impact[hidden], .tariff-impact details[hidden] { display: none; }
.tariff-impact summary { cursor: pointer; color: var(--accent); font-weight: 500; font-size: 14px; }
.tariff-impact table { margin-top: var(--s2); background: var(--panel); border-radius: var(--r-sm); }
.stack { display: grid; gap: var(--s5); align-content: start; grid-template-columns: minmax(0, 1fr); min-width: 0; }

/* ---------- row «⋯» menu ---------- */
.menu { display: inline-block; }
.menu-list { position: fixed; z-index: 70; min-width: 180px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-sm); box-shadow: 0 8px 24px rgba(11,18,32,.12); padding: 4px; display: grid; }
.menu-list[hidden] { display: none; }
.menu-list > a, .menu-list > button { display: flex; align-items: center; gap: var(--s2); padding: 8px 10px; border: 0; background: none;
  border-radius: 6px; font: inherit; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer; }
.menu-list > a:hover, .menu-list > button:hover, .menu-list > :focus-visible { background: var(--hover); text-decoration: none; outline: none; }
.menu-list .danger { color: var(--rejected); }
.menu-list .danger:hover { background: var(--rejected-bg); }
.menu-list svg { flex: none; opacity: .8; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover > td { background: var(--hover); }
.pager { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); }
.pager [aria-disabled="true"] { opacity: .4; pointer-events: none; box-shadow: none; }
.panel > .pager { margin: 0; padding: var(--s3) var(--s4); border-top: 1px solid var(--line); }

/* payouts: three figures, date period filter, cancelled rows */
.figures.figures-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .figures.figures-3 { grid-template-columns: 1fr; } .figures.figures-3 .figure { border-left: 0; border-top: 1px solid var(--line-2); } .figures.figures-3 .figure:first-child { border-top: 0; } }
.filter-date { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
@media (max-width: 640px) { .filter-date .input { flex: 1 1 0; min-width: 0; } }
.filter-date .input { width: auto; }
tr.is-cancelled td { color: var(--ink-3); }
tr.is-cancelled .row-link { color: var(--ink-3); }
@media (min-width: 861px) and (max-width: 1100px) { .figures.figures-3 .figure:nth-child(3) { border-left: 1px solid var(--line-2); border-top: 0; } }

/* product form: «Для покупателя» folds (only the customer page needs it) */
.client-details > summary { cursor: pointer; list-style: none; flex-wrap: nowrap; }
.client-details > summary::-webkit-details-marker { display: none; }
.client-details:not([open]) > summary { border-bottom: 0; }
.client-toggle { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--ink-2); flex: none; }
.client-details > summary:hover .client-toggle { background: var(--accent-tint); color: var(--accent); }
.client-details[open] .client-toggle svg { transform: rotate(180deg); }

/* size rows: trash button; a saved size marked for deletion stays visible (dimmed) with «Вернуть» */
.size-del { justify-self: end; color: var(--ink-2); }
.size-del:hover { color: var(--rejected); }
.size-row.is-deleted input:not([type=hidden]) { opacity: .45; text-decoration: line-through; pointer-events: none; }
.size-row.is-deleted .size-del { color: var(--accent); font-size: 13px; }
/* photo tiles: × to delete (with «Вернуть»), the round mark picks the main photo */
.photo-del { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; display: grid; place-items: center; border: 0;
  border-radius: 50%; background: rgba(11, 18, 32, .62); color: #fff; cursor: pointer; }
.photo-del:hover { background: var(--rejected); }
.photo-main { position: absolute; left: 6px; bottom: 6px; cursor: pointer; }
.photo-main input { position: absolute; opacity: 0; }
.photo-main span { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 99px;
  background: rgba(11, 18, 32, .62); color: #fff; font-size: 12px; font-weight: 500; }
.photo-main span::before { content: "Сделать главной"; }
.photo-main input:checked + span { background: var(--accent); }
.photo-main input:checked + span::before { content: "★ Главная"; }
.photo-main input:focus-visible + span { outline: 2px solid #fff; outline-offset: 1px; }
.photo-gone { display: none; position: absolute; inset: 0; background: rgba(247, 248, 250, .88); flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.photo-tile.is-deleted .photo-gone { display: flex; }
.photo-tile.is-deleted .photo-del, .photo-tile.is-deleted .photo-main { display: none; }

/* video tiles in the model form */
.video-tile { background: #1B2230; }
.video-tile video { width: 100%; height: 100%; object-fit: cover; }
.video-badge { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; height: 24px;
  padding: 0 8px; border-radius: 99px; background: rgba(11, 18, 32, .62); color: #fff; font-size: 12px; font-weight: 500; }
.photo-tile.is-deleted .video-badge { display: none; }
