/* ============================================================
   NOMAD — единая дизайн-система приложения
   Светло-серый фон · белые карточки · бирюзовые акценты · тёмный текст
   Используется кабинетом клиента, интерфейсом склада и страницами входа.
   ============================================================ */
:root {
  --teal: #008080; --teal-d: #005f5f; --teal-l: #37b3a3; --teal-soft: #e0f2f1; --mint: #6ecfc0;
  --ink: #17242a; --ink-2: #3c4a50; --muted: #64757c;
  --bg: #f4f7f7; --card: #ffffff; --line: #e2e9e9; --line-soft: #eef3f3;
  --green: #2b7a2f; --green-bg: #e6f5e7;
  --red: #c33; --red-bg: #fdecec;
  --orange: #b47710; --orange-bg: #fdf3e0;
  --violet: #6b21a8; --violet-bg: #f5ecff;
  --blue: #1257a0; --blue-bg: #e3f0ff;
  --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-xl: 20px;
  --sh-1: 0 1px 3px rgba(7,46,46,.06); --sh-2: 0 4px 16px rgba(7,46,46,.08);
  --sh-3: 0 20px 50px rgba(7,46,46,.16);
  --fh: 'Montserrat', -apple-system, sans-serif;
  --fb: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 60px; --side-w: 236px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--fb); font-size: 15px; line-height: 1.55; color: var(--ink); background: var(--bg); }
img { max-width: 100%; display: block; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-d); }
h1,h2,h3,h4 { font-family: var(--fh); line-height: 1.25; }
button, input, select, textarea { font-family: inherit; font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c9d5d5; border-radius: 5px; }

/* ---------------- кнопки ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1.5px solid transparent; border-radius: var(--r-m); padding: 11px 18px;
  font-weight: 700; font-size: 14.5px; cursor: pointer; transition: .16s; white-space: nowrap;
  min-height: 44px; background: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--teal-d); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.btn-soft { background: var(--teal-soft); color: var(--teal-d); }
.btn-soft:hover:not(:disabled) { background: #cfe9e7; }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red); color: #fff; }
.btn-wa { background: #25d366; color: #fff; }
.btn-wa:hover { background: #1fb457; }
.btn-sm { padding: 7px 13px; font-size: 13px; min-height: 36px; border-radius: var(--r-s); }
.btn-lg { padding: 14px 26px; font-size: 16px; min-height: 50px; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; min-height: 40px; min-width: 40px; }

/* ---------------- карточки ---------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 20px; box-shadow: var(--sh-1); }
.card-h { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-h h3 { font-size: 16px; font-weight: 800; flex: 1; min-width: 0; }
.card-h h2 { font-size: 19px; font-weight: 800; flex: 1; min-width: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* статистика */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px 18px; }
.stat .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .v { font-family: var(--fh); font-size: 26px; font-weight: 900; margin-top: 2px; line-height: 1.1; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat.clickable { cursor: pointer; transition: .18s; }
.stat.clickable:hover { border-color: var(--teal); transform: translateY(-2px); box-shadow: var(--sh-2); }

/* ---------------- бейджи ---------------- */
.pill { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 12px;
  font-weight: 700; white-space: nowrap; }
.pill-teal { background: var(--teal-soft); color: var(--teal-d); }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-orange { background: var(--orange-bg); color: var(--orange); }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-violet { background: var(--violet-bg); color: var(--violet); }
.pill-grey { background: #eef1f2; color: var(--muted); }
.mp-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800;
  padding: 3px 8px; border-radius: 7px; }
.mp-wildberries { background: #f5e8ff; color: #6b21a8; }
.mp-ozon { background: #e3ecff; color: #0b4fc4; }
.mp-manual { background: #eef1f2; color: var(--muted); }

/* ---------------- таблицы ---------------- */
.tbl-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-l);
  overflow: hidden; box-shadow: var(--sh-1); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; padding: 12px 14px; background: #fafcfc;
  border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); font-size: 14px; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.row-link { cursor: pointer; }
.tbl tbody tr.row-link:hover { background: #f7fbfb; }
.tbl .total-row td { font-weight: 800; background: var(--teal-soft); }

/* ---------------- формы ---------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.inp, .field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r-m);
  background: #fff; color: var(--ink); outline: none; transition: .15s; min-height: 46px; }
.inp:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,128,128,.1); }
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.field.err input, .field.err select { border-color: var(--red); }
.field .err-msg { font-size: 12.5px; color: var(--red); margin-top: 5px; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.fgrid .full { grid-column: 1/-1; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; font-size: 14.5px; }
.check input { width: 19px; height: 19px; accent-color: var(--teal); flex-shrink: 0; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-btn { flex: 1; min-width: 120px; border: 1.5px solid var(--line); background: #fff;
  border-radius: var(--r-m); padding: 13px 14px; cursor: pointer; text-align: left; transition: .16s; }
.seg-btn b { display: block; font-size: 14.5px; font-weight: 800; }
.seg-btn small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.seg-btn.on { border-color: var(--teal); background: rgba(0,128,128,.05); color: var(--teal-d); }

/* фильтры */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .inp, .filters select { min-height: 42px; width: auto; min-width: 150px; }
.filters .search { min-width: 220px; flex: 1; max-width: 340px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 20px; padding: 7px 14px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 38px; }
.chip.on { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---------------- состояния ---------------- */
.state { padding: 44px 24px; text-align: center; color: var(--muted); }
.state .ico { font-size: 40px; margin-bottom: 10px; }
.state b { display: block; font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.state p { font-size: 14px; max-width: 420px; margin: 0 auto 14px; }
.state-box { background: var(--card); border: 1px dashed var(--line); border-radius: var(--r-l); }
.state-err { background: var(--red-bg); border-color: #f3c7c7; color: var(--red); }
.state-err b { color: var(--red); }
.skel { background: linear-gradient(90deg, #eef2f2 25%, #f7fafa 50%, #eef2f2 75%);
  background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-s); }
@keyframes sk { to { background-position: -200% 0; } }
.skel-row { height: 46px; margin-bottom: 8px; }
.spin { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: sp .7s linear infinite; display: inline-block; }
.spin-dark { border-color: rgba(0,128,128,.25); border-top-color: var(--teal); }
@keyframes sp { to { transform: rotate(360deg); } }
.soon { background: var(--orange-bg); color: var(--orange); border: 1px dashed #e8c98a;
  border-radius: var(--r-m); padding: 12px 15px; font-size: 13.5px; }

/* ---------------- тосты ---------------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex;
  flex-direction: column; gap: 9px; max-width: 360px; }
.toast { background: #122b2b; color: #fff; padding: 13px 17px; border-radius: var(--r-m);
  box-shadow: var(--sh-2); font-size: 14px; animation: tin .22s ease; }
.toast.ok { background: #0b5e50; } .toast.err { background: #9b2c2c; } .toast.warn { background: #8a5a12; }
@keyframes tin { from { transform: translateY(12px); opacity: 0; } }

/* ---------------- модальные окна ---------------- */
.modal-back { position: fixed; inset: 0; background: rgba(9,35,35,.55); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: var(--r-xl); width: 560px; max-width: 100%;
  max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--sh-3); animation: mup .22s ease; }
.modal.wide { width: 860px; }
@keyframes mup { from { transform: translateY(18px); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; font-weight: 800; flex: 1; }
.modal-x { border: none; background: none; font-size: 20px; color: var(--muted); cursor: pointer;
  min-width: 36px; min-height: 36px; border-radius: var(--r-s); }
.modal-x:hover { background: var(--bg); }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px;
  border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------------- каркас приложения ---------------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; background: #fff; border-bottom: 1px solid var(--line);
  height: var(--nav-h); display: flex; align-items: center; gap: 16px; padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--fh); font-weight: 900;
  font-size: 15px; color: var(--ink); letter-spacing: .02em; }
.brand b { display: block; font-size: 9px; letter-spacing: .28em; color: var(--teal); font-weight: 700; }
.brand span { line-height: 1.05; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: var(--r-m);
  cursor: pointer; }
.user-chip:hover { background: var(--bg); }
.user-chip .av { width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex-shrink: 0; }
.user-chip .nm { font-size: 13.5px; font-weight: 700; line-height: 1.2; }
.user-chip .nm small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.bell { position: relative; }
.bell-dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: 9px; font-size: 10.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; }

.shell { display: flex; flex: 1; min-height: 0; }
.side { width: var(--side-w); background: #fff; border-right: 1px solid var(--line);
  padding: 14px 10px; flex-shrink: 0; overflow-y: auto; }
.side-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 13px;
  border: none; background: none; border-radius: var(--r-m); color: var(--ink-2); font-size: 14.5px;
  font-weight: 600; text-align: left; cursor: pointer; margin-bottom: 2px; min-height: 44px; }
.side-item:hover { background: var(--bg); }
.side-item.on { background: var(--teal-soft); color: var(--teal-d); font-weight: 700; }
.side-item .ic { width: 20px; text-align: center; font-size: 16px; flex-shrink: 0; }
.side-item .cnt { margin-left: auto; background: var(--teal); color: #fff; font-size: 11px;
  font-weight: 800; padding: 1px 7px; border-radius: 10px; }
.side-sep { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; color: #9db0b0;
  text-transform: uppercase; padding: 14px 13px 6px; }
.main { flex: 1; min-width: 0; padding: 22px; overflow-x: hidden; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 900; }
.page-head p { font-size: 13.5px; color: var(--muted); width: 100%; margin-top: -4px; }

/* нижняя навигация на телефоне */
.bottom-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #fff; border-top: 1px solid var(--line); padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr); }
.bn-item { display: flex; flex-direction: column; align-items: center; gap: 2px; border: none;
  background: none; padding: 7px 2px; color: var(--muted); font-size: 10.5px; font-weight: 700;
  cursor: pointer; border-radius: var(--r-s); min-height: 52px; }
.bn-item .ic { font-size: 19px; }
.bn-item.on { color: var(--teal); }

/* список карточек вместо таблицы на телефоне */
.cards-list { display: none; }
.rec { background: #fff; border: 1px solid var(--line); border-radius: var(--r-m);
  padding: 14px; margin-bottom: 10px; }
.rec-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.rec-top b { font-size: 15px; flex: 1; }
.rec-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 13.5px; }
.rec-row span { color: var(--muted); }
.rec-row b { font-weight: 700; }

/* шаги мастера */
.steps { display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 4px; }
.step-chip { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 20px;
  background: #fff; border: 1.5px solid var(--line); font-size: 13px; font-weight: 700;
  color: var(--muted); white-space: nowrap; cursor: pointer; }
.step-chip .n { width: 22px; height: 22px; border-radius: 50%; background: var(--line);
  color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 12px; }
.step-chip.on { border-color: var(--teal); color: var(--teal-d); background: rgba(0,128,128,.05); }
.step-chip.on .n { background: var(--teal); color: #fff; }
.step-chip.done .n { background: var(--green); color: #fff; }
.step-chip.done { color: var(--ink-2); }

/* таймлайн статусов */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-row { display: flex; gap: 12px; padding: 9px 0; font-size: 13.5px; }
.tl-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--teal); margin-top: 6px; flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--teal-soft); }
.tl-row.past .tl-dot { background: var(--line); box-shadow: 0 0 0 3px var(--line-soft); }
.tl-row b { display: block; }
.tl-row span { color: var(--muted); font-size: 12.5px; }

/* --------------- адаптив --------------- */
@media (max-width: 900px) {
  .g2, .g3, .fgrid { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 14px 14px 84px; }
  .bottom-nav { display: grid; }
  .topbar { padding: 0 14px; gap: 10px; }
  .user-chip .nm { display: none; }
  .page-head h1 { font-size: 19px; }
  .tbl-wrap.responsive { display: none; }
  .cards-list { display: block; }
  .modal { max-height: 94vh; border-radius: var(--r-xl) var(--r-xl) 0 0; align-self: flex-end; width: 100%; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal.wide { width: 100%; }
  .filters .search { max-width: none; width: 100%; }
  .filters .inp, .filters select { flex: 1; min-width: 130px; }
}
@media (max-width: 420px) {
  body { font-size: 14.5px; }
  .card { padding: 15px; }
  .stat .v { font-size: 22px; }
  .btn { padding: 10px 14px; }
}
@media print {
  .topbar, .side, .bottom-nav, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; }
}

/* ============ SVG-иконки кабинета (единый стиль) ============ */
.ico, svg.ico { display: inline-block; flex: 0 0 auto; vertical-align: -.18em; }
.ico.flip { transform: rotate(180deg); }
.state .ico { font-size: 0; display: flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 12px;
  background: var(--teal-soft, rgba(0,128,128,.1)); color: var(--teal, #008080); }
.state-err .ico { background: rgba(200,60,60,.1); color: var(--red, #c33); }
.soon { display: flex; align-items: center; gap: 8px; }
.modal-x { font-size: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; }
.side-item, .bn-item, .btn { display: inline-flex; align-items: center; gap: 8px; }
.side-item { width: 100%; }
.side-item .ic, .bn-item .ic { font-size: 0; display: inline-flex; align-items: center;
  justify-content: center; width: 20px; height: 20px; }
.bn-item { flex-direction: column; gap: 3px; }
.ntf-ic { font-size: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  background: var(--teal-soft, rgba(0,128,128,.1)); color: var(--teal, #008080); }
.p-photo.ph { font-size: 0; color: var(--muted, #64757c); }
.wms-note > span { font-size: 0; display: inline-flex; color: var(--teal, #008080); }
.wh-check { font-size: 0; display: flex !important; align-items: center; justify-content: center; }
.privacy { display: flex; align-items: flex-start; gap: 8px; }
.card-h h3 { display: flex; align-items: center; gap: 8px; }
