/* Temki Logistics — тёмная тема по макетам (design/confirmeditems), цвета — по логотипу
   (design/TemkiLogisticsLogo.png): синий #0068FC и тёмно-синий #142430.
   Сетка, отступы и радиусы — из design/DESIGN.md: шаг 4px, радиус 10px, плашки 30px. */

:root {
  --bg: #070b12;
  --surface: #101823;
  --surface-2: #172231;
  --surface-3: #202d40;
  --line: #1b2636;
  --line-strong: #2b3a50;
  --text: #ffffff;
  --text-2: #c8d1de;
  --muted: #8592a6;
  --brand-navy: #142430;
  --accent: #0068fc;          /* заливки: кнопки, переключатели, точки */
  --accent-hover: #1f7bff;
  --accent-ink: #ffffff;      /* текст на синем */
  --accent-text: #5c9dff;     /* синий текст на тёмном фоне — светлее ради читаемости */
  --accent-soft: rgba(0, 104, 252, .16);
  --ok: #6fdc9a;
  --warn: #ffb547;
  --danger: #ff6b6b;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 30px;
  --gutter: 40px;
  --page: 1280px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.45 var(--font-sans); letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }

/* --- Типографика ---------------------------------------------------------- */
.h-display, .h1, .h2, .h3 { font-weight: 800; letter-spacing: -0.045em; margin: 0; }
.h-display { font-size: clamp(44px, 7vw, 96px); line-height: .95; }
.h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.02; }
.h2 { font-size: 28px; line-height: 1.05; }
.h3 { font-size: 20px; line-height: 1.15; letter-spacing: -0.03em; }
.lead { font: 400 18px/1.45 var(--font-serif); color: var(--muted); margin: 10px 0 0; letter-spacing: 0; }
.serif { font-family: var(--font-serif); letter-spacing: 0; }
.mono, .label {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.01em; text-transform: uppercase;
}
.label { color: var(--muted); }
.label-accent { color: var(--accent-text); }
.muted { color: var(--muted); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* --- Кнопки --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 20px; border-radius: var(--radius); border: 1px solid transparent;
  font: 500 14px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .01em;
  text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-outline { background: transparent; border-color: var(--accent); color: var(--accent-text); }
.btn-outline:hover { background: var(--accent-soft); }
.btn-line { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-line:hover { border-color: var(--muted); }
.btn-lg { min-height: 56px; font-size: 15px; padding: 0 28px; }
.btn-block { width: 100%; justify-content: space-between; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 12px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius);
  background: var(--surface-2); border: 0; cursor: pointer; color: var(--text); text-decoration: none;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 18px; height: 18px; }

/* --- Шапка и подвал ------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(7, 11, 18, .88); backdrop-filter: blur(12px); }
.header-row { display: flex; align-items: center; gap: 16px; height: 84px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800;
        font-size: 20px; letter-spacing: -0.05em; }
.logo img { height: 30px; width: auto; display: block; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--text); color: var(--bg);
             display: grid; place-items: center; font-size: 15px; letter-spacing: -0.08em; }
.footer-logo { height: 36px; width: auto; margin-bottom: 14px; }
.logo small { font: 500 12px var(--font-mono); color: var(--muted); letter-spacing: 0; text-transform: uppercase; }
.header-spacer { flex: 1; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
          display: grid; place-items: center; font: 600 14px var(--font-mono); text-transform: uppercase; }

.site-footer { margin-top: 96px; padding-bottom: 40px; }
.footer-card { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 36px;
               display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer-card h2 { margin-bottom: 10px; }
.footer-card ul { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 12px; }
.footer-card a { text-decoration: none; }
.footer-card a:hover { color: var(--accent-text); }
.footer-title { font: 400 16px var(--font-serif); color: var(--muted); }

/* --- Карточки и поверхности ----------------------------------------------- */
.card { background: var(--surface); border-radius: var(--radius-lg); padding: 24px; }
.card-outline { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 24px; }
.section { margin-top: 64px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--radius-pill);
  font: 500 12px/1 var(--font-mono); text-transform: uppercase; background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-ok { background: rgba(111, 220, 154, .12); color: var(--ok); }
.badge-warn { background: rgba(255, 181, 71, .12); color: var(--warn); }
.badge-muted { color: var(--muted); }

.alert { border-radius: var(--radius); padding: 12px 16px; font-size: 14px; }
.alert-error { background: rgba(255, 107, 107, .12); color: var(--danger); }
.alert-ok { background: rgba(111, 220, 154, .1); color: var(--ok); }
.alert-info { background: var(--surface-2); color: var(--text-2); }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--danger); font-size: 13px; }

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px;
          width: min(480px, calc(100vw - 32px)); }
.toast { background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius);
         padding: 14px 16px; font-size: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .5); transition: opacity .3s; }
.toast-success { border-color: rgba(111, 220, 154, .4); }
.toast-error { border-color: rgba(255, 107, 107, .5); }

/* --- Поля ----------------------------------------------------------------- */
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field > label, .field-label { font: 500 13px var(--font-mono); text-transform: uppercase; color: var(--muted); }
.field-hint { font: 400 14px/1.4 var(--font-serif); color: var(--muted); }
.input, .field input[type=text], .field input[type=url], .field input[type=number], .field input[type=tel],
.field textarea, .field select {
  width: 100%; min-height: 48px; padding: 12px 16px; border-radius: var(--radius);
  background: transparent; border: 1px solid var(--line-strong); color: var(--text); font-size: 15px;
  transition: border-color .15s, background .15s;
}
.field textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
.field select { appearance: none; background: var(--surface-2); }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent); background: rgba(255, 255, 255, .02);
}
.field input::placeholder, .field textarea::placeholder { color: #5e5e64; }
.field input[type=file] { font-size: 13px; color: var(--muted); }
.field-error input, .field-error textarea { border-color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.stepper { display: inline-flex; align-items: stretch; height: 48px; border: 1px solid var(--line-strong);
           border-radius: var(--radius); overflow: hidden; }
.stepper button { width: 48px; border: 0; background: var(--surface-2); cursor: pointer; font-size: 20px; }
.stepper button:hover { background: var(--surface-3); }
.stepper input { width: 72px; border: 0 !important; border-radius: 0 !important; text-align: center;
                 font-family: var(--font-mono); min-height: 0 !important; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* Сегментный переключатель (как SNUG / STANDARD / LOOSE в макете) */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px;
             background: var(--surface-2); border-radius: var(--radius); }
.segmented label { display: grid; place-items: center; min-height: 44px; border-radius: 8px; cursor: pointer;
                   font: 500 13px var(--font-mono); text-transform: uppercase; color: var(--text-2); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { color: var(--accent-ink); }
.segmented label:has(input:checked) { background: var(--accent); color: var(--accent-ink); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 4px; }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 15px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

/* Шкала из макета: три отрезка с засечками */
.scale { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; position: relative; padding: 0 2px; }
.scale span { height: 2px; background: var(--line-strong); position: relative; }
.scale span.on { background: var(--accent); }
.scale::before, .scale::after { content: ""; position: absolute; top: -3px; width: 2px; height: 8px; background: var(--accent); }
.scale::before { left: 0; } .scale::after { right: 0; }

/* Строки сводки: метка слева, значение справа */
.rows { display: grid; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 0;
       border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .label { flex: none; }
.row-value { font: 500 14px var(--font-mono); text-align: right; text-transform: uppercase; overflow-wrap: anywhere; }
.row-value.plain { text-transform: none; }
.row small { display: block; color: var(--muted); font: 400 12px var(--font-mono); text-transform: none; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; padding-top: 18px;
             margin-top: 4px; border-top: 1px solid var(--line-strong); }
.total-value { font: 600 30px/1 var(--font-mono); letter-spacing: -0.03em; }

/* --- Боковая панель-мастер (как в макете) --------------------------------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .6);
                   backdrop-filter: blur(10px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer {
  position: fixed; z-index: 50; top: 24px; right: 24px; bottom: 24px; width: min(440px, calc(100vw - 48px));
  background: var(--surface); border-radius: var(--radius-lg); display: flex; flex-direction: column;
  transform: translateX(calc(100% + 40px)); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
}
.drawer.is-open { transform: none; }
.drawer.is-open ~ .drawer-backdrop, .drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }
.drawer-close { position: absolute; top: 18px; right: 18px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 32px 24px 16px; }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 24px 24px; }
.drawer .label-accent { display: block; margin-bottom: 10px; padding-right: 48px; }
.drawer .h2 { margin-bottom: 8px; padding-right: 32px; }
.drawer .lead { margin: 0 0 28px; font-size: 17px; }
.step { display: none; }
.step.is-active { display: block; }
.no-js .step { display: block; margin-bottom: 40px; }
.terms { background: var(--surface-2); border-radius: var(--radius); padding: 4px 18px; max-height: 260px; overflow-y: auto;
         font: 400 14px/1.5 var(--font-serif); color: var(--text-2); margin-bottom: 18px; }
.terms ol { padding-left: 18px; }
.terms li { margin: 8px 0; }

/* --- Лендинг -------------------------------------------------------------- */
.hero { padding: 72px 0 24px; display: grid; gap: 28px; max-width: 900px; }
.hero .lead { font-size: 21px; max-width: 640px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 48px; }
.feature { display: flex; gap: 16px; align-items: center; background: var(--surface); border-radius: var(--radius);
           padding: 16px; font: 500 13px/1.4 var(--font-mono); text-transform: uppercase; }
.feature-icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; color: var(--accent-text);
                border: 1px dashed rgba(0, 104, 252, .6); border-radius: 4px; position: relative; }
.feature-icon svg { width: 22px; height: 22px; }
.steps-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.steps-list .card { min-height: 180px; display: flex; flex-direction: column; justify-content: space-between; }
.steps-list .big { font: 800 64px/1 var(--font-sans); letter-spacing: -0.06em; color: rgba(255, 255, 255, .12); }

/* --- Кабинет покупателя ---------------------------------------------------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 0 28px;
             flex-wrap: wrap; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.aside { position: sticky; top: 100px; }
.aside .h3 { margin-bottom: 4px; }

.items-panel { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; min-height: 420px; }
.items-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.empty {
  display: grid; place-items: center; text-align: center; gap: 14px; min-height: 360px; padding: 32px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: none; width: 100%; cursor: pointer;
  color: var(--text); transition: border-color .15s, background .15s;
}
.empty:hover { border-color: var(--accent); background: rgba(0, 104, 252, .03); }
.empty .plus { width: 56px; height: 56px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink);
               display: grid; place-items: center; }
.empty .plus svg { width: 26px; height: 26px; }

.item-list { display: grid; gap: 8px; }
.item {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: start;
  background: var(--surface-2); border-radius: var(--radius); padding: 12px;
}
.item-thumb { width: 96px; height: 96px; border-radius: 8px; background: var(--bg); overflow: hidden;
              display: grid; place-items: center; }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-thumb .platform-mark { font: 600 12px var(--font-mono); color: var(--muted); text-transform: uppercase; }
.item-title { font-weight: 700; font-size: 16px; letter-spacing: -0.03em; margin: 2px 0 2px; }
.item-link { display: block; font: 400 12px var(--font-mono); color: var(--muted); text-decoration: none;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.item-link:hover { color: var(--accent-text); }
.props { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.prop { display: inline-flex; gap: 6px; height: 26px; align-items: center; padding: 0 9px; border-radius: 6px;
        background: var(--surface-3); font: 500 12px var(--font-mono); text-transform: uppercase; }
.prop b { color: var(--muted); font-weight: 500; }
.item-comment { font: 400 15px/1.45 var(--font-serif); color: var(--text-2); margin: 10px 0 0; }
.item-side { display: grid; justify-items: end; gap: 8px; text-align: right; }
.item-price { font: 600 17px var(--font-mono); }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.item.is-removed { opacity: .45; }
.item.is-removed .item-title { text-decoration: line-through; }
.note { border-left: 2px solid var(--accent); padding: 4px 0 4px 12px; margin-top: 12px; font-size: 14px; color: var(--text-2); }
.note .label { display: block; margin-bottom: 2px; font-size: 11px; }

.orders-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.order-card { background: var(--surface); border-radius: var(--radius); padding: 18px; text-decoration: none;
              display: grid; gap: 14px; transition: background .15s; }
.order-card:hover { background: var(--surface-2); }
.order-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-card-bottom { display: flex; justify-content: space-between; align-items: baseline; }
.thumbs-row { display: flex; gap: 4px; }
.thumbs-row span { width: 44px; height: 44px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.thumbs-row img { width: 100%; height: 100%; object-fit: cover; }

.status-hero { text-align: left; padding: 48px 40px; background: var(--surface); border-radius: var(--radius-lg); }
.status-hero .h1 { margin: 12px 0 0; max-width: 720px; }
.pulse { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
         box-shadow: 0 0 0 0 rgba(0, 104, 252, .6); animation: pulse 1.8s infinite; margin-right: 10px; vertical-align: middle; }
@keyframes pulse { 70% { box-shadow: 0 0 0 12px rgba(0, 104, 252, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 104, 252, 0); } }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: flex; gap: 12px; align-items: center; padding: 10px 0; font: 500 13px var(--font-mono);
               text-transform: uppercase; color: var(--muted); }
.timeline li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; }
.timeline li.done { color: var(--text); }
.timeline li.done::before { background: var(--accent); border-color: var(--accent); }
.timeline li.current::before { box-shadow: 0 0 0 4px var(--accent-soft); }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gallery-grid a { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.gallery-grid img { width: 100%; height: 100%; object-fit: cover; }

/* --- Панель менеджера ------------------------------------------------------ */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--radius);
       background: var(--surface-2); text-decoration: none; font: 500 13px var(--font-mono); text-transform: uppercase; }
.tab.is-active { background: var(--text); color: var(--bg); }
.tab .count { color: var(--muted); }
.tab.is-active .count { color: #555; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font: 500 12px var(--font-mono); text-transform: uppercase; color: var(--muted);
            padding: 10px 12px; border-bottom: 1px solid var(--line-strong); }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--surface); }
.table a { text-decoration: none; }
.m-item { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr); gap: 16px; background: var(--surface);
          border-radius: var(--radius-lg); padding: 20px; margin-bottom: 8px; }
.m-item.is-removed { opacity: .5; }
.m-request { border-right: 1px solid var(--line); padding-right: 16px; min-width: 0; }
.m-request .item-link { white-space: normal; word-break: break-all; color: var(--text-2); margin: 8px 0; }
.m-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 10px; }
.m-fields .span-2 { grid-column: span 2; }
.m-fields .span-4 { grid-column: span 4; }
.m-fields .field { margin-bottom: 12px; }
.screens { display: flex; gap: 6px; margin-top: 10px; }
.screens a { width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.screens img { width: 100%; height: 100%; object-fit: cover; }
.savebar { position: sticky; bottom: 0; z-index: 10; background: linear-gradient(transparent, var(--bg) 30%);
           padding: 28px 0 20px; display: flex; gap: 8px; justify-content: flex-end; }

/* --- Адаптивность ---------------------------------------------------------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .aside { position: static; }
  .orders-grid { grid-template-columns: repeat(2, 1fr); }
  .m-item { grid-template-columns: 1fr; }
  .m-request { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 16px; }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .header-row { height: 64px; }
  .logo img { height: 26px; }
  .features, .steps-list, .orders-grid, .footer-card { grid-template-columns: 1fr; }
  .footer-card { padding: 24px; }
  .item { grid-template-columns: 72px minmax(0, 1fr); }
  .item-thumb { width: 72px; height: 72px; }
  .item-side { grid-column: 1 / -1; justify-items: start; text-align: left; grid-auto-flow: column; justify-content: space-between; align-items: center; }
  .drawer { top: auto; right: 8px; left: 8px; bottom: 8px; width: auto; max-height: calc(100dvh - 32px);
            transform: translateY(calc(100% + 40px)); }
  .status-hero { padding: 32px 20px; }
  .m-fields { grid-template-columns: 1fr 1fr; }
  .m-fields .span-4 { grid-column: span 2; }
  .grid-2 { grid-template-columns: 1fr; }
  .table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Без JavaScript панели показываются обычными блоками внизу страницы */
.no-js .drawer { position: static; transform: none; width: auto; margin: 24px auto; max-width: 640px; box-shadow: none; }
.no-js .drawer-backdrop, .no-js .drawer-close, .no-js [data-prev], .no-js [data-next], .no-js .scale { display: none; }

/* --- Правки по скриншотам ---------------------------------------------------- */
[hidden] { display: none !important; }
.drawer > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.item > div, .m-item > div { min-width: 0; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .site-header .btn-outline { display: none; }
  .page-head .h2 { font-size: 22px; }
  .items-panel { padding: 12px; }
  .items-head { flex-wrap: wrap; gap: 6px; }
  .card-outline { padding: 20px; }
  .total-value { font-size: 26px; }
  .drawer-foot { padding: 12px 16px 16px; }
  .drawer-body { padding: 28px 16px 12px; }
  .savebar { flex-wrap: wrap; }
  .savebar .btn { flex: 1; }
}
.photo-row { display: flex; gap: 14px; align-items: flex-start; }
.photo-row .field { flex: 1; }
.photo-preview { width: 76px; height: 76px; flex: none; border-radius: 8px; overflow: hidden; background: var(--surface-2); margin-top: 24px; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.field input[type=file]::file-selector-button {
  margin-right: 12px; padding: 8px 14px; border: 0; border-radius: 8px; background: var(--surface-3); color: var(--text);
  font: 500 12px var(--font-mono); text-transform: uppercase; cursor: pointer;
}

/* --- Отслеживание ------------------------------------------------------------- */
.track-form { display: flex; gap: 8px; max-width: 640px; }
.track-form .input { flex: 1; min-width: 0; min-height: 56px; padding: 0 18px; border-radius: var(--radius);
                     background: transparent; border: 1px solid var(--line-strong); color: var(--text);
                     font: 500 17px var(--font-mono); letter-spacing: .04em; text-transform: uppercase; }
.track-form .input:focus { outline: none; border-color: var(--accent); }
.track-result { max-width: 640px; }
.changed-flag { display: inline-flex; align-items: center; gap: 6px; color: var(--warn); }
.m-item.is-changed { box-shadow: inset 0 0 0 1px rgba(255, 181, 71, .55); }
.live-sum { font: 600 15px var(--font-mono); padding-top: 14px; }
@media (max-width: 720px) {
  .track-form { flex-direction: column; }
}

/* --- Панель менеджера: навигация, настройки, покупатели --------------------- */
.manage-nav { display: flex; gap: 4px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.settings-side { display: grid; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.tiers { display: grid; gap: 0; margin-top: 10px; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr 110px; gap: 0 12px; align-items: center; }
.tier-row .field { margin-bottom: 12px; }
.tier-delete { padding-top: 12px; }
.search { display: flex; gap: 8px; }
.search .input { min-height: 44px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-strong);
                 background: transparent; color: var(--text); width: 280px; }
.search .input:focus { outline: none; border-color: var(--accent); }
.avatar-sm { display: inline-grid; width: 28px; height: 28px; font-size: 12px; vertical-align: middle; margin-right: 8px; }
.copy-input { width: 100%; min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong);
              background: var(--surface-2); color: var(--text-2); font-size: 12px; text-transform: none; }

/* --- Номер для отслеживания у покупателя ------------------------------------ */
.track-chip { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px;
              border-radius: 8px; background: var(--surface-3); }
.track-chip .mono { font-size: 13px; letter-spacing: .03em; }
.track-box { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--line-strong);
             border-radius: var(--radius); }
.track-box .label { margin-right: 4px; }
.track-code { font-size: 15px; letter-spacing: .04em; }
[data-copy].is-done { background: var(--accent); color: var(--accent-ink); }

@media (max-width: 1100px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .manage-nav .tab { padding: 0 10px; font-size: 12px; }
  .grid-3 { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .search .input { width: auto; flex: 1; }
  .track-box { width: 100%; }
  .track-box .label { display: none; }
  .track-code { flex: 1; }
}

/* --- Telegram Mini App ----------------------------------------------------------
   Включается классом .tg-app (ставит static/js/tg.js только внутри Telegram).
   Шапку и подвал сайта прячем: заголовок и «Назад» даёт сам Telegram. */
.tg-app .site-header, .tg-app .site-footer, .tg-app .tg-hide { display: none !important; }
.tg-app main.wrap { padding-top: calc(var(--tg-content-safe-area-inset-top, 0px) + 12px);
                    padding-bottom: calc(var(--tg-content-safe-area-inset-bottom, 0px) + var(--tg-safe-area-inset-bottom, 0px) + 24px); }
.tg-app .page-head { padding-top: 8px; }
.tg-app .drawer { bottom: calc(8px + var(--tg-safe-area-inset-bottom, 0px)); }
.tg-app .toasts { bottom: calc(24px + var(--tg-safe-area-inset-bottom, 0px)); }
.tg-app body { -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }

.app-splash { min-height: 70vh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 24px; }
.app-splash [data-state] { display: grid; gap: 12px; justify-items: center; max-width: 420px; }
.app-splash [data-state][hidden] { display: none; }
.splash-logo { height: 56px; width: auto; }

/* --- Автозаполнение позиции в панели менеджера --------------------------------- */
.autofill { margin-top: 14px; display: grid; gap: 10px; }
.autofill .btn { justify-self: start; }
.autofill-status { margin: 0; text-transform: none; font-size: 12px; }
.autofill-status.is-error { color: var(--danger); }
.autofill-status.is-ok { color: var(--ok); }
.autofill select { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2);
                   border: 1px solid var(--line-strong); color: var(--text); font: 13px var(--font-mono); }
.btn.is-loading { opacity: .6; pointer-events: none; }
