@font-face {
  font-family: Inter;
  src: url("/static/fonts/Inter-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F6F6F6;
  --card: #FFFFFF;
  --ink: #111111;
  --ink2: #4A4A4A;
  --mute: #767676;
  --line: #E8E8E8;
  --blue: #156BFF;
  --blue-h: #0F57D6;
  --blue-soft: #EAF1FF;
  --r: 20px;
  --r-sm: 12px;
  --font: Inter, system-ui, sans-serif;
  --shadow: 0 8px 24px rgba(17, 17, 17, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-h); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.wrap { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }

.hdr {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.hdr__in {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 800 22px/1 var(--font);
  letter-spacing: -0.03em;
  color: var(--ink);
}
.logo__m {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font: 800 13px/1 var(--font);
}
.logo span { color: var(--mute); font-weight: 600; font-size: 13px; letter-spacing: 0.04em; margin-left: 4px; }
.hdr__nav { display: flex; gap: 8px; margin-left: auto; align-items: center; }

.btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font: 600 14px var(--font);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  white-space: nowrap;
}
.btn:hover { background: var(--blue-h); color: #fff; }
.btn--ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); background: #fff; }
.btn--soft { background: var(--blue-soft); color: var(--blue); }
.btn--soft:hover { background: #dbe7ff; color: var(--blue-h); }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.page { padding: 28px 0 64px; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h1 { font: 800 32px/1.1 var(--font); letter-spacing: -0.03em; }
.page-head p { color: var(--ink2); margin-top: 6px; }
.crumbs { font-size: 13px; color: var(--mute); margin-bottom: 10px; }
.crumbs a { color: var(--mute); }
.crumbs a:hover { color: var(--blue); }

.flash {
  background: var(--blue-soft);
  color: var(--blue-h);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 550;
  margin-bottom: 16px;
}
.error {
  background: #FFF0F0;
  color: #B42318;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.search {
  flex: 1 1 260px;
  height: 44px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 14px;
}
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 14px;
}
.search input::placeholder { color: var(--mute); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 13px var(--font);
  color: var(--ink);
  white-space: nowrap;
}
.chip em { font-style: normal; font-size: 12px; color: var(--mute); font-weight: 500; }
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.is-active em { color: rgba(255,255,255,.8); }

.card {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
}
.table-wrap { overflow-x: auto; }
table.orders { width: 100%; border-collapse: collapse; min-width: 760px; }
.orders th, .orders td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.orders th {
  font: 600 12px var(--font);
  color: var(--mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #fafafa;
}
.orders tr:last-child td { border-bottom: 0; }
.orders tr:hover td { background: #fbfbfd; }
.orders a.num { font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.orders a.num:hover { color: var(--blue); }
.muted { color: var(--mute); }
.who { display: flex; flex-direction: column; gap: 2px; }
.who strong { font-weight: 600; }
.who span { font-size: 13px; color: var(--mute); }
.check { width: 36px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--blue); }

.badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  font: 600 12px/26px var(--font);
  white-space: nowrap;
}
.st-new { background: var(--blue-soft); color: var(--blue); }
.st-paid { background: #EAF8F0; color: #147A43; }
.st-packing { background: #FFF6E5; color: #A15C00; }
.st-shipped { background: #F1ECFF; color: #5B3FC0; }
.st-delivered { background: #E8F8EE; color: #1B7A3D; }
.st-cancelled { background: #F0F0F0; color: #767676; }

.batch-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--ink2);
  font-size: 14px;
}

.mobile-list { display: none; }
.m-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 10px;
}
.m-card__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.m-card__num { font-weight: 700; color: var(--ink); }
.m-card__meta { margin-top: 8px; color: var(--ink2); font-size: 14px; display: grid; gap: 2px; }
.m-card__row { display: flex; justify-content: space-between; margin-top: 10px; align-items: center; }

.grid-2 { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 16px; align-items: start; }
.panel { background: #fff; border-radius: var(--r); padding: 24px; }
.panel h2 { font: 700 18px/1.2 var(--font); margin-bottom: 16px; letter-spacing: -0.02em; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 14px; }
.dl dt { color: var(--mute); }
.dl dd { color: var(--ink); word-break: break-word; }
.items { width: 100%; border-collapse: collapse; margin-top: 8px; }
.items th, .items td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.items th { color: var(--mute); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.items td.num, .items th.num { text-align: right; }
.total-row { font-weight: 700; }
.label-box { background: #fff; border-radius: var(--r); padding: 20px; }
.label-box img {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.label-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.qr-link { font-size: 12px; color: var(--mute); margin-top: 10px; word-break: break-all; }
.history { list-style: none; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history li:last-child { border-bottom: 0; }

.form { display: grid; gap: 20px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field--wide { grid-column: 1 / -1; }
.field label { font: 600 13px var(--font); color: var(--ink2); }
.field input, .field select, .field textarea {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0 14px;
  outline: none;
}
.field textarea { height: 88px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.item-rows { display: flex; flex-direction: column; gap: 8px; }
.item-row {
  display: grid;
  grid-template-columns: 1.4fr 1.1fr 80px 100px 36px;
  gap: 8px;
  align-items: center;
}
.item-row input { height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; width: 100%; }
.item-row .icon-btn {
  width: 36px; height: 36px; border: 0; background: var(--bg); border-radius: 10px; color: var(--mute);
}
.item-row .icon-btn:hover { background: #FFF0F0; color: #B42318; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--mute); }

.public { max-width: 640px; margin: 40px auto 64px; }
.public .hero-num { font: 800 28px/1.1 var(--font); letter-spacing: -0.03em; margin: 8px 0 16px; }
.ftr { color: var(--mute); font-size: 12px; text-align: center; padding: 24px 0 8px; }

@media (max-width: 860px) {
  .wrap { width: calc(100% - 28px); }
  .page { padding: 20px 0 48px; }
  .page-head h1 { font-size: 26px; }
  .grid-2, .fields { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dt { margin-top: 8px; }
  .table-desktop { display: none; }
  .mobile-list { display: block; }
  .item-row { grid-template-columns: 1fr 1fr; }
  .item-row input:nth-child(1),
  .item-row input:nth-child(2) { grid-column: 1 / -1; }
  .hdr__in { height: 56px; }
  .logo { font-size: 18px; }
  .hdr__nav .btn--ghost { display: none; }
}

.logo__img { width: 32px; height: 32px; border-radius: 9px; display: block; }
.wrap--wide { width: min(1400px, calc(100% - 32px)); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.login-card { max-width: 420px; margin: 48px auto; }
.login-card h1 { font: 800 28px/1.1 var(--font); letter-spacing: -0.03em; }

.table-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.col-menu-wrap { position: relative; display: flex; gap: 8px; }
.col-menu {
  position: absolute; right: 0; top: 42px; z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; min-width: 240px; max-height: 360px; overflow: auto;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px;
}
.col-menu label { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.linkish { border: 0; background: none; color: var(--blue); font: 600 12px var(--font); cursor: pointer; margin-left: auto; }

.sheet-scroll { overflow: auto; max-height: calc(100vh - 280px); }
.sheet-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 960px; }
.sheet-table th, .sheet-table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line);
  border-right: 1px solid #f0f0f0; font-size: 13px; white-space: nowrap;
  max-width: 280px; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle;
}
.sheet-table th {
  position: sticky; top: 0; z-index: 2;
  background: #fafafa; font: 600 11px var(--font); color: var(--mute);
  letter-spacing: 0.04em; text-transform: uppercase; cursor: pointer;
}
.sheet-table td.sticky-col, .sheet-table th.sticky-col {
  position: sticky; left: 36px; background: #fff; z-index: 1;
}
.sheet-table th.sticky-col { z-index: 3; background: #fafafa; }
.sheet-table td.check, .sheet-table th.check { width: 36px; position: sticky; left: 0; background: #fff; z-index: 2; }
.sheet-table th.check { z-index: 4; background: #fafafa; }
.sheet-table tr:hover td { background: #f7f9ff; }
.sheet-table td.editable { cursor: cell; }
.sheet-table td.editing { padding: 2px; overflow: visible; }
.cell-input {
  width: 100%; min-width: 80px; height: 32px; border: 1px solid var(--blue);
  border-radius: 8px; padding: 0 8px; outline: none; background: #fff;
}
.sheet-table td.saving { opacity: 0.6; }
.sheet-empty { padding: 24px; }

.dlg { border: 0; border-radius: 20px; padding: 24px; width: min(420px, 92vw); box-shadow: var(--shadow); }
.dlg::backdrop { background: rgba(17,17,17,.28); }
.payload { background: var(--bg); border-radius: 12px; padding: 14px; font: 12px/1.45 ui-monospace, monospace; overflow: auto; max-height: 420px; white-space: pre-wrap; }

/* Скриншоты без ПД: ?mask=1 */
body.is-mask .pii-name,
body.is-mask .pii-phone,
body.is-mask .pii-email,
body.is-mask .pii-promo,
body.is-mask td[data-pii],
body.is-mask .who strong,
body.is-mask .who span,
body.is-mask pre,
body.is-mask .payload,
body.is-mask .raw-payload,
body.is-mask .label-box img,
body.is-mask .label-card img,
body.is-mask .label-preview img { filter: blur(8px); user-select: none; }

@media (max-width: 860px) {
  .sheet-scroll { max-height: none; }
  .wrap--wide { width: calc(100% - 20px); }
}
