/* Мир морозильников — портал. Палитра и типографика из дизайн-прототипа PLUR. */
:root {
  --blue: #1F5FD8; --blue-soft: #ECF2FE; --blue-dark: #17458F;
  --ink: #101828; --ink2: #475467; --mute: #98A2B3; --line: #E4E7EC;
  --bg: #EDF0F3; --card: #FFFFFF;
  --green: #067647; --green-soft: #ECFDF3;
  --amber: #B54708; --amber-soft: #FFFAEB;
  --red: #B42318; --red-soft: #FEF3F2;
  --dark: #101828; --dark2: #1D2939; --dark-line: #344054;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; color: var(--ink); font-size: 14px;
}
a { color: var(--blue); text-decoration: none; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #CFD5DD; border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }

/* ---------- каркас ---------- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 52px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: var(--dark); color: #fff; position: sticky; top: 0; z-index: 50; white-space: nowrap;
}
.logo { display: flex; align-items: center; gap: 9px; }
.logo-badge { width: 26px; height: 26px; border-radius: 5px; background: var(--blue); display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.logo-name { font-size: 13px; font-weight: 600; }
.logo-sub { font-size: 11px; color: var(--mute); padding-left: 8px; border-left: 1px solid var(--dark-line); }
.top-user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 12px; }
.top-user .who { text-align: right; line-height: 1.3; }
.top-user .who b { display: block; font-weight: 600; }
.top-user .who span { color: var(--mute); font-size: 11px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); display: flex;
  align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.btn-exit { background: var(--dark2); color: #fff; border: 1px solid var(--dark-line); border-radius: 6px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; }

.shell { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 232px; flex: none; background: #fff; border-right: 1px solid var(--line);
  padding: 10px 8px; overflow-y: auto; position: sticky; top: 52px; height: calc(100vh - 52px);
}
.nav-cap { font-size: 10px; font-weight: 600; letter-spacing: .08em; color: var(--mute); padding: 0 8px 7px; }
.nav-item { display: flex; align-items: center; gap: 9px; min-height: 30px; padding: 0 8px; border-radius: 6px;
  color: var(--ink2); font-size: 12.5px; font-weight: 500; cursor: pointer; margin-bottom: 1px; }
.nav-item:hover { background: #F2F4F7; }
.nav-item.active { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 2px; flex: none; background: #D0D5DD; }
.nav-item.active .dot { background: var(--blue); }
.nav-sep { margin: 10px 10px 6px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }

.content { flex: 1; min-width: 0; padding: 20px 22px 80px; }
.page-h { margin: 0 0 2px; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.page-sub { color: var(--ink2); font-size: 13px; margin: 0 0 16px; max-width: 760px; line-height: 1.45; }

/* ---------- компоненты ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.grid { display: grid; gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .v { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.kpi .l { font-size: 12px; color: var(--ink2); }
.kpi .d { font-size: 11px; color: var(--mute); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--mute); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid #F2F4F7; vertical-align: top; }
.tbl tr:hover td { background: #FAFBFC; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-gray { background: #F2F4F7; color: var(--ink2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; font-weight: 600;
  padding: 9px 14px; cursor: pointer; min-height: 38px; }
.btn:hover { background: #F7F9FB; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.big { min-height: 48px; font-size: 15px; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.inp, select.inp, textarea.inp { width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink); min-height: 42px; }
.inp:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--ink2); margin: 0 0 5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--dark);
  color: #fff; padding: 10px 18px; border-radius: 9px; font-size: 13px; z-index: 300; max-width: 92vw;
  box-shadow: 0 8px 24px rgba(16,24,40,.25); }

.modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 200; display: flex;
  align-items: flex-end; justify-content: center; }
.modal { background: #fff; border-radius: 14px 14px 0 0; width: 100%; max-width: 560px; max-height: 88vh;
  overflow-y: auto; padding: 18px 16px 24px; }
@media (min-width: 768px) {
  .modal-bg { align-items: center; }
  .modal { border-radius: 14px; }
}

/* ---------- мобильная адаптация: вёрстка по мобильным мокапам дизайн-проекта ---------- */
.bottom-nav, .m-head { display: none; }
.mn { font-family: 'SF Mono', ui-monospace, Menlo, monospace; }
@media (max-width: 900px) {
  body { background: #F4F6F8; }
  .topbar, .sidebar { display: none; }
  .m-head { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: #fff; border-bottom: 1px solid var(--line); padding: 12px 16px 10px;
    position: sticky; top: 0; z-index: 50; }
  .m-head .t { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
  .m-head .s { font-size: 11.5px; color: #667085; margin-top: 2px; }
  .m-head .avatar { width: 34px; height: 34px; background: var(--blue-soft); color: var(--blue); flex: none; }
  .content { padding: 12px 12px 96px; }
  .page-h, .page-sub { display: none; }
  .card { border-radius: 11px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    background: #fff; border-top: 1px solid var(--line); padding: 0 0 env(safe-area-inset-bottom);
  }
  .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; min-height: 60px; color: var(--mute); font-size: 10.5px; font-weight: 500; cursor: pointer; }
  .bn-item .sq { width: 19px; height: 19px; border-radius: 5px; border: 1.6px solid var(--mute); }
  .bn-item.active { color: var(--blue); }
  .bn-item.active .sq { border-color: var(--blue); background: var(--blue); }
  .grid { grid-template-columns: 1fr !important; }
  .grid.kpis { grid-template-columns: 1fr 1fr !important; }
  /* таблицы → стопка карточек, как в мобильных мокапах */
  .card:has(> .tbl-wrap) { background: transparent; border: none; padding: 0 !important; }
  .card:has(> .tbl-wrap) > .lbl { padding: 0 3px; font-size: 12.5px; color: var(--ink2); }
  .tbl thead { display: none; }
  .tbl, .tbl tbody { display: block; width: 100%; }
  .tbl tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 11px;
    padding: 10px 14px; margin-bottom: 10px; }
  .tbl tr:hover td { background: transparent; }
  .tbl td { display: block; border: none; padding: 3px 0; }
  .tbl td:empty { display: none; }
  .tbl td.num { text-align: left; font-family: 'SF Mono', ui-monospace, Menlo, monospace; }
  .tbl td[data-l] { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
  .tbl td[data-l]::before { content: attr(data-l); font-size: 11.5px; color: #667085; font-weight: 400;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; flex: none; }
  .tbl td.row { display: flex; padding-top: 8px; }
  .tbl .btn { min-height: 44px; flex: 1; border-radius: 10px; }
  /* компактная карточка строки: заголовок + числа + статусы; остальное — в шторке по тапу */
  .tbl tr.m-row { position: relative; padding-right: 30px; cursor: pointer; }
  .tbl tr.m-row::after { content: '›'; position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
    font-size: 20px; color: var(--mute); }
  .tbl tr.m-row > td { display: none; }
  .tbl tr.m-row > td:first-child { display: block; }
  .tbl tr.m-row > td.num { display: flex; }
  .tbl tr.m-row > td:has(.badge) { display: block; padding-top: 6px; }
  .tbl tr.m-row > td.num[data-l], .tbl tr.m-row > td[data-l]:has(.badge) { display: flex; }
  .btn { border-radius: 9px; }
  .inp { border-radius: 10px; }
}
@media (min-width: 901px) { .m-only { display: none !important; } }

/* компоненты мобильных мокапов (используются и на десктопе в узких карточках) */
.m-scanbtn { background: var(--blue); border-radius: 12px; padding: 18px 16px; color: #fff; cursor: pointer;
  display: flex; align-items: center; gap: 13px; border: none; width: 100%; text-align: left; font-family: inherit; }
.m-scanbtn .frame { width: 46px; height: 46px; border-radius: 11px; border: 2px solid rgba(255,255,255,.55); flex: none; }
.m-scanbtn .big { font-size: 17px; font-weight: 600; }
.m-scanbtn .sub { font-size: 12px; color: #D6E4FF; margin-top: 2px; }
.m-tile { flex: 1; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; }
.m-tile .l { font-size: 11px; color: #667085; }
.m-tile .v { font-size: 17px; font-weight: 600; margin-top: 3px; }
.m-bar { flex: 1; height: 7px; border-radius: 4px; background: #F2F4F7; overflow: hidden; }
.m-bar > div { height: 100%; background: var(--blue); }
.m-link { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 14px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; }
.m-link .arr { font-size: 18px; color: var(--mute); }
.m-radio { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.m-radio.on { border-color: var(--blue); background: var(--blue-soft); }
.photo-ph { height: 150px; background: repeating-linear-gradient(135deg,#F2F4F7 0 10px,#EAECF0 10px 20px);
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--mute); }
.m-primary { min-height: 50px; width: 100%; background: var(--blue); color: #fff; border: none; border-radius: 11px;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
.m-secondary { min-height: 50px; width: 100%; background: #fff; color: var(--ink); border: 1px solid var(--line);
  border-radius: 11px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
/* шторка деталей строки (мобилка): поля + действия */
.m-sheet .sheet-title { font-size: 15px; font-weight: 600; padding-bottom: 10px; border-bottom: 1px solid var(--line);
  margin-bottom: 4px; }
.m-sheet .sheet-title .small, .m-sheet .sheet-title .muted { font-weight: 400; }
.m-sheet .sheet-field { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid #F2F4F7; font-size: 13.5px; }
.m-sheet .sheet-field.num { font-family: 'SF Mono', ui-monospace, Menlo, monospace; }
.m-sheet .sheet-field[data-l]::before { content: attr(data-l); font-size: 12px; color: #667085;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; flex: none; }
.m-sheet .sheet-act { display: flex; flex-direction: column; gap: 9px; padding-top: 14px; }
.m-sheet .sheet-act .btn { min-height: 48px; width: 100%; border-radius: 11px; font-size: 14px; }
.m-sheet .sheet-act .btn:first-child { background: var(--blue); border-color: var(--blue); color: #fff; }

/* сканер — тёмный полноэкранный оверлей как в мокапе */
.scan-ov { position: fixed; inset: 0; background: #0B1220; z-index: 400; display: flex; flex-direction: column; }
.scan-ov .view { flex: 1; position: relative; min-height: 0; }
.scan-ov video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.scan-ov .frame { position: absolute; left: 34px; right: 34px; top: 32%; height: 170px;
  border: 2px solid rgba(255,255,255,.85); border-radius: 12px; }
.scan-ov .line { position: absolute; left: 44px; right: 44px; height: 2px; background: #4E8BF5;
  box-shadow: 0 0 12px #4E8BF5; animation: scanline2 2s ease-in-out infinite alternate; }
@keyframes scanline2 { 0% { top: 22%; } 100% { top: 72%; } }
.scan-ov .hint { position: absolute; left: 0; right: 0; top: 20px; text-align: center; color: #D6E4FF; font-size: 13px; }
.scan-ov .btns { padding: 16px; display: flex; flex-direction: column; gap: 9px; }
.scan-ov .dark-btn { min-height: 48px; border: 1px solid #344054; color: #D6E4FF; background: transparent;
  border-radius: 11px; font-size: 13.5px; cursor: pointer; font-family: inherit; }

/* продавец: главный экран */
.sell-hero { background: var(--blue); color: #fff; border-radius: 14px; padding: 18px 16px; }
.sell-hero .big-scan { width: 100%; min-height: 56px; border: none; background: #fff; color: var(--blue);
  font-size: 16px; font-weight: 700; border-radius: 10px; cursor: pointer; display: flex; gap: 10px;
  align-items: center; justify-content: center; }
.stock-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 2px; border-bottom: 1px solid #F2F4F7; min-height: 48px; }
.cart-fab { position: fixed; right: 14px; bottom: 84px; z-index: 90; background: var(--blue); color: #fff;
  border: none; border-radius: 999px; min-height: 52px; padding: 0 20px; font-size: 15px; font-weight: 700;
  box-shadow: 0 8px 20px rgba(31,95,216,.4); cursor: pointer; }

/* сканер */
.scan-video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 3/4; object-fit: cover; }
.scan-frame { position: relative; }
.scan-line { position: absolute; left: 8%; right: 8%; height: 2px; background: #E7515A; top: 8%;
  animation: scanline 2.2s linear infinite alternate; border-radius: 2px; }
@keyframes scanline { 0% { top: 8%; } 100% { top: 88%; } }

/* логин */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, #101828 0%, #1D2939 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 28px 24px; width: 100%; max-width: 380px; }
.code-inp { font-size: 26px; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Menlo, monospace; font-size: 12px; }
.muted { color: var(--mute); } .small { font-size: 12px; }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--blue-soft);
  border-top-color: var(--blue); border-radius: 50%; animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
