/* Оформление клиентского приложения.

   Имена классов и переменные — те же, что в макете `client-app-design.html`,
   чтобы правку в макете можно было перенести сюда один в один. Убрано только
   то, что было лесами просмотрщика: рамка телефона, вкладки экранов и
   переключатель темы. Тему теперь задаёт Telegram. */

:root {
  --red: #FF1027; --red-deep: #d40e21; --blue: #1663B0;
  --ink: #0d0d0d; --muted: #7a7f87; --faint: #b0b4ba;
  --rule: #e6e8eb; --band: #f5f6f8; --paper: #ffffff; --page: #ffffff;
  --green: #1a8a52; --amber: #c07a12;
  --pill-transit-bg: #fdf1de; --pill-done-bg: #e3f5ea;
  --tint-truck: rgba(255,16,39,.09); --tint-air: rgba(22,99,176,.09);
  --logo-src: url("/static/img/logo-light.png");
  --mark: url("/static/img/mark.png");
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
}

/* Тему ставит JS по colorScheme из Telegram; медиазапрос — на случай, когда
   приложение открыли в обычном браузере (например, при отладке). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f2f3f5; --muted: #8b9198; --faint: #5c626a;
    --rule: #2a2e33; --band: #1f2226; --paper: #17191c; --page: #17191c;
    --green: #2fb972; --amber: #e0a13a; --blue: #4a9de8;
    --pill-transit-bg: rgba(224,161,58,.14); --pill-done-bg: rgba(47,185,114,.14);
    --tint-truck: rgba(255,16,39,.14); --tint-air: rgba(74,157,232,.14);
    --logo-src: url("/static/img/logo-dark.png");
  }
}
:root[data-theme="dark"] {
  --ink: #f2f3f5; --muted: #8b9198; --faint: #5c626a;
  --rule: #2a2e33; --band: #1f2226; --paper: #17191c; --page: #17191c;
  --green: #2fb972; --amber: #e0a13a; --blue: #4a9de8;
  --pill-transit-bg: rgba(224,161,58,.14); --pill-done-bg: rgba(47,185,114,.14);
  --tint-truck: rgba(255,16,39,.14); --tint-air: rgba(74,157,232,.14);
  --logo-src: url("/static/img/logo-dark.png");
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: var(--page); min-height: 100%; }
body { background: var(--page); min-height: 100dvh;
       font-family: 'Manrope', system-ui, -apple-system, sans-serif;
       color: var(--ink); overscroll-behavior-y: none; }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.screen { display: none; min-height: 100dvh; padding-top: var(--safe-top); }
.screen.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
/* Экраны с нижним меню не должны прятать под ним последнюю карточку:
   иначе палец попадает по меню, а не по кнопке. Список обязан совпадать
   с WITH_NAV в app.js — он уже однажды разошёлся, и у «Посылок» третья
   карточка уехала под меню. Сверяет их проверка в tests/test_panel.py. */
#screen-list, #screen-profile, #screen-owner, #screen-clients, #screen-parcels {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
}
#screen-client, #screen-reviews, #screen-settings {
  padding-bottom: calc(var(--safe-bottom) + 24px);
}
#screen-list, #screen-profile, #screen-detail,
#screen-owner, #screen-clients, #screen-client, #screen-reviews,
#screen-settings, #screen-parcels {
  padding-top: calc(var(--safe-top) + 16px);
}

/* ── 1. Загрузка ── */
.splash { min-height: 100dvh; background: var(--red); position: relative; overflow: hidden;
          display: flex; flex-direction: column; align-items: center; justify-content: center;
          margin-top: calc(-1 * var(--safe-top)); }
.splash-dragon { position: absolute; width: 300px; height: 540px;
                 background: var(--mark) no-repeat center/contain;
                 opacity: .07; right: -90px; bottom: -60px; }
.splash-logo { width: 210px; height: 60px;
               background: url("/static/img/logo-white.png") no-repeat center/contain;
               position: relative; z-index: 2; animation: rise .7s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
.splash-tag { position: relative; z-index: 2; margin-top: 18px; font-size: 13px; font-weight: 700;
              text-transform: uppercase; letter-spacing: .22em; text-indent: .22em;
              color: rgba(255,255,255,.9); animation: rise .7s .15s ease both; }
.dots { position: absolute; bottom: calc(64px + var(--safe-bottom)); display: flex; gap: 6px; z-index: 2; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.55);
          animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s } .dots i:nth-child(3) { animation-delay: .4s }
@keyframes blink { 0%,100% { opacity: .35 } 50% { opacity: 1 } }

/* ── 2. Вход ── */
.auth { padding: 54px 26px calc(36px + var(--safe-bottom)); display: flex; flex-direction: column;
        align-items: center; min-height: calc(100dvh - var(--safe-top)); }
.auth-logo { width: 176px; height: 50px; background: var(--logo-src) no-repeat center/contain;
             margin-bottom: 30px; }
.auth h2 { font-size: 19px; font-weight: 700; text-align: center; letter-spacing: -.01em; }
.auth .sub { font-size: 13.5px; color: var(--muted); text-align: center; line-height: 1.55;
             margin: 8px 0 30px; max-width: 268px; }
.btn-primary { width: 100%; padding: 15px; border-radius: 14px; background: var(--red);
               color: #fff; font-size: 14.5px; font-weight: 700;
               display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary:disabled { opacity: .55; }
.btn-primary svg { width: 17px; height: 17px; }
/* Поле кода приглашения. Код диктуют и набирают с телефона, поэтому он
   крупный, в разрядку и заглавными — так видно, что набрано. */
.code-entry { width: 100%; margin-bottom: 14px; }
.code-entry input { width: 100%; padding: 15px; border-radius: 14px; border: 1.5px solid var(--rule);
                    background: var(--paper); color: var(--ink); text-align: center;
                    font-size: 19px; font-weight: 700; letter-spacing: .18em;
                    text-transform: uppercase; }
.code-entry input::placeholder { letter-spacing: .08em; color: var(--faint); font-weight: 600; }
.code-entry input:focus { outline: none; border-color: var(--red); }
.code-err { margin-top: 8px; font-size: 12.5px; color: var(--red); text-align: center;
            line-height: 1.5; }

/* Ник правится прямо в строке профиля — отдельный экран ради одного поля
   был бы дорогой дорогой к мелочи. */
.nick-edit { display: flex; gap: 8px; flex: 1 1 100%; }
.nick-edit input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px;
                   border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
                   font-size: 13px; }
.nick-edit button { padding: 0 16px; border-radius: 10px; background: var(--band);
                    font-size: 12.5px; font-weight: 700; color: var(--ink); }

.privacy { display: flex; gap: 8px; margin-top: 18px; padding: 12px 14px; border-radius: 12px;
           background: var(--band); font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.privacy svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; color: var(--faint); }
.auth-foot { margin-top: auto; padding-top: 26px; font-size: 12px; color: var(--faint); text-align: center; }
.lnk { color: var(--red); font-weight: 700; cursor: pointer; }

/* ── 3. Проверка ── */
.checking { padding: 54px 26px; display: flex; flex-direction: column; align-items: center;
            justify-content: center; min-height: calc(100dvh - var(--safe-top)); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--rule);
           border-top-color: var(--red); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.checking p { margin-top: 20px; font-size: 14px; font-weight: 600; }
.checking .phone-num { margin-top: 4px; font-size: 13px; color: var(--muted);
                       font-variant-numeric: tabular-nums; }

/* ── 4. Не найден ── */
.notfound { padding: 54px 26px calc(36px + var(--safe-bottom)); display: flex; flex-direction: column;
            align-items: center; min-height: calc(100dvh - var(--safe-top)); }
.nf-icon { width: 64px; height: 64px; border-radius: 20px; background: var(--tint-truck);
           display: flex; align-items: center; justify-content: center; margin-bottom: 22px; }
.nf-icon svg { width: 28px; height: 28px; color: var(--red); }
.notfound h2 { font-size: 19px; font-weight: 700; text-align: center; }
.notfound .sub { font-size: 13.5px; color: var(--muted); text-align: center; line-height: 1.55;
                 margin: 8px 0; max-width: 272px; }
.nf-phone { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
            padding: 9px 16px; background: var(--band); border-radius: 100px; margin-bottom: 28px; }
.btn-ghost { width: 100%; margin-top: 10px; padding: 14px; border: 1.5px solid var(--rule);
             border-radius: 14px; font-size: 13.5px; font-weight: 700;
             display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-ghost svg { width: 17px; height: 17px; flex-shrink: 0; }

/* ── 5. Отправления ── */
.app-head { display: flex; align-items: center; justify-content: space-between; padding: 0 20px 16px; }
.app-head .lg { width: 118px; height: 34px; background: var(--logo-src) no-repeat left center/contain; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--band); color: var(--muted);
          display: flex; align-items: center; justify-content: center; font-size: 12px;
          font-weight: 700; cursor: pointer; }
.greeting { padding: 0 20px 10px; font-size: 17px; font-weight: 700;
            letter-spacing: -.01em; }
.code-hero { margin: 0 20px 16px; background: linear-gradient(135deg, var(--red), var(--red-deep));
             border-radius: 16px; padding: 15px 18px; color: #fff; position: relative; overflow: hidden; }
.code-hero .drg { position: absolute; right: -28px; top: -22px; width: 92px; height: 166px;
                  background: var(--mark) no-repeat center/contain; opacity: .16;
                  filter: brightness(0) invert(1); }
.code-hero .lbl { font-size: 11.5px; opacity: .85; font-weight: 600; position: relative; }
.code-hero .val { font-size: 25px; font-weight: 800; letter-spacing: .01em; margin-top: 1px;
                  font-variant-numeric: tabular-nums; position: relative; }
.code-hero .who { font-size: 11.5px; opacity: .8; margin-top: 2px; position: relative; }

.filters { display: flex; gap: 6px; padding: 0 20px 14px; overflow-x: auto;
           scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 100px;
          border: 1px solid var(--rule); color: var(--muted); white-space: nowrap;
          flex-shrink: 0; }
.filter.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.ship-list { padding: 0 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.ship-card { display: flex; align-items: center; gap: 12px; padding: 12px; width: 100%;
             border: 1px solid var(--rule); border-radius: 14px; text-align: left; }
.ship-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center;
             justify-content: center; flex-shrink: 0; }
.ship-icon.truck { background: var(--tint-truck); color: var(--red); }
.ship-icon.air { background: var(--tint-air); color: var(--blue); }
.ship-icon svg { width: 18px; height: 18px; }
.ship-body { flex: 1; min-width: 0; }
.ship-body .num { font-size: 13.5px; font-weight: 700; }
.ship-body .meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.status-pill { font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: 100px;
               white-space: nowrap; flex-shrink: 0; }
.status-pill.transit { background: var(--pill-transit-bg); color: var(--amber) }
.status-pill.done { background: var(--pill-done-bg); color: var(--green) }
.status-pill.new { background: var(--band); color: var(--muted) }
.empty .empty-go { margin-top: 18px; }
.empty { padding: 40px 30px; text-align: center; font-size: 13.5px; color: var(--muted);
         line-height: 1.55; }

/* ── 6. Детали ── */
.detail-top { display: flex; align-items: center; gap: 10px; padding: 0 20px 14px; cursor: pointer; }
.detail-top svg { width: 18px; height: 18px; color: var(--muted); }
.detail-top span { font-size: 14px; font-weight: 700; }
.detail-hero { padding: 0 20px 6px; }
.detail-mode { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.detail-mode svg { width: 15px; height: 15px; color: var(--red); }
.detail-mode span { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--red); }
.detail-mode.air svg, .detail-mode.air span { color: var(--blue); }
.detail-sum { font-size: 30px; font-weight: 800; letter-spacing: -.02em;
              font-variant-numeric: tabular-nums; }
.detail-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.detail-eta { margin-top: 8px; display: inline-block; font-size: 12px; font-weight: 700;
              color: var(--amber); background: var(--pill-transit-bg);
              padding: 5px 11px; border-radius: 100px; }
.progress { padding: 22px 26px 8px; display: flex; align-items: flex-start; }
.p-step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.p-dot { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center;
         justify-content: center; z-index: 2; }
.p-dot svg { width: 12px; height: 12px; color: #fff; }
.p-dot.done { background: var(--green) } .p-dot.active { background: var(--amber) }
.p-dot.pending { background: var(--paper); border: 2px solid var(--rule) }
.p-label { font-size: 10px; color: var(--muted); margin-top: 6px; text-align: center; }
.p-label.active { color: var(--ink); font-weight: 700; }
.p-line { position: absolute; top: 11px; left: 50%; width: 100%; height: 2px; z-index: 1; }
.p-line.done { background: var(--green) } .p-line.pending { background: var(--rule) }
.detail-items { margin: 18px 20px 0; border-top: 1px solid var(--rule); padding-top: 12px; }
.item-row { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; font-size: 13px; }
.item-row .label { color: var(--muted); }
.item-row span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-row.total { border-top: 1px solid var(--rule); margin-top: 4px; padding-top: 10px;
                  font-weight: 700; font-size: 14px; }
.detail-actions { padding: 20px 20px calc(32px + var(--safe-bottom)); }
.btn-outline { width: 100%; padding: 13px; border: 1.5px solid var(--ink); border-radius: 12px;
               font-size: 13.5px; font-weight: 700; display: flex; align-items: center;
               justify-content: center; gap: 7px; }
.btn-outline:disabled { opacity: .5; }
.btn-outline svg { width: 15px; height: 15px; }

/* ── 7. Профиль ── */
.profile-head { padding: 4px 20px 18px; display: flex; align-items: center; gap: 14px; }
.pf-avatar { width: 56px; height: 56px; border-radius: 50%;
             background: linear-gradient(135deg, var(--red), var(--red-deep));
             color: #fff; display: flex; align-items: center; justify-content: center;
             font-size: 18px; font-weight: 800; flex-shrink: 0; }
.pf-name { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.pf-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

.status-card { margin: 0 20px 18px; border: 1px solid var(--rule); border-radius: 16px; padding: 15px 17px; }
.sc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sc-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.sc-badge svg { width: 16px; height: 16px; color: var(--red); }
.sc-soon { font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--band);
           padding: 3px 9px; border-radius: 100px; }
.sc-note { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px 18px; }
.stat { background: var(--band); border-radius: 14px; padding: 13px 15px; }
.stat .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-top: 3px;
           font-variant-numeric: tabular-nums; }
.stat .x { font-size: 10.5px; color: var(--faint); margin-top: 1px; }

.rows { margin: 0 20px 20px; border: 1px solid var(--rule); border-radius: 16px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; }
.row + .row { border-top: 1px solid var(--rule); }
.row svg.lead { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.row .t { flex: 1; font-size: 13.5px; font-weight: 600; }
.row .r { font-size: 12.5px; color: var(--muted); }
.row svg.chev { width: 15px; height: 15px; color: var(--faint); }

/* ── Нижнее меню ── */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex;
              border-top: 1px solid var(--rule); background: var(--paper);
              padding-bottom: var(--safe-bottom); z-index: 10; }
.nav-item { flex: 1; padding: 11px 0 12px; display: flex; flex-direction: column; align-items: center;
            gap: 3px; color: var(--faint); }
.nav-item.active { color: var(--red); }
.nav-item svg { width: 21px; height: 21px; }
.nav-item span { font-size: 10px; font-weight: 700; }

/* ── Сообщение об ошибке ── */
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
         background: var(--ink); color: var(--page); padding: 12px 16px; border-radius: 12px;
         font-size: 13px; line-height: 1.45; z-index: 20; animation: fade .2s ease; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Контакты, тема, режим владельца ── */

.row.no-tap { cursor: default; }
.rows:empty { display: none; }

/* Переключатель темы. Три состояния, а не два: «Авто» идёт за системой,
   и человеку должно быть видно, что приложение не выбирает само. */
.seg { display: flex; gap: 2px; padding: 2px; background: var(--band); border-radius: 100px; }
/* Переключатель во всю ширину — для выбора валюты на экране финансов. */
.seg.wide { margin: 0 20px 10px; }
.seg.wide button { flex: 1; padding: 8px 10px; font-size: 12.5px; }
.seg button { font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 100px;
              color: var(--muted); white-space: nowrap; }
.seg button.active { background: var(--paper); color: var(--ink);
                     box-shadow: 0 1px 3px rgba(0,0,0,.12); }
:root[data-theme="dark"] .seg button.active { box-shadow: none; background: var(--rule); }

/* Выбор из двух подписей длиннее переключателя, и в одну строку с названием
   он сдавливал бы и себя, и его. Кладём кнопки под подпись — по левому краю
   с текстом, а не с иконкой. */
/* Опоздание — предупреждение, а не ошибка: груз едет, просто дольше
   обещанного. Поэтому тёплый цвет, а не красный «сломалось». */
.detail-eta.late { background: rgba(214, 138, 0, .14); color: #a06400; }
:root:not([data-theme="light"]) .detail-eta.late { color: #f0b03a; }
:root[data-theme="dark"] .detail-eta.late { color: #f0b03a; }

/* ── Список клиентов ──
   Карточка, а не строка: имя у клиента длинное («Попов Андрей
   Александрович»), и в одну строку с цифрами оно всегда обрезалось до
   «По…». Имя занимает свою строку целиком, цифры уходят под него. */
.cl-search { display: flex; align-items: center; gap: 9px; margin: 0 20px 12px;
             padding: 10px 13px; border: 1px solid var(--rule); border-radius: 12px;
             background: var(--band); }
.cl-search svg { width: 15px; height: 15px; color: var(--faint); flex-shrink: 0; }
.cl-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none;
                   font: inherit; font-size: 14px; color: var(--ink); }

.cl-list { margin: 0 20px 20px; border: 1px solid var(--rule); border-radius: 16px;
           overflow: hidden; }
/* Внутри блока сводки поля уже заданы им самим. */
.own-block .cl-list, .own-rows.cl-list { margin: 0; border-radius: 14px; }
.cl-item { display: block; padding: 12px 15px; cursor: pointer; }
.cl-item + .cl-item { border-top: 1px solid var(--rule); }
.cl-item .n { display: flex; align-items: baseline; gap: 8px; }
.cl-item .name { flex: 1; min-width: 0; font-size: 14px; font-weight: 700;
                 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-item .sum { font-size: 13px; font-weight: 700; white-space: nowrap;
                font-variant-numeric: tabular-nums; }
.cl-item .m { margin-top: 3px; font-size: 11.5px; color: var(--muted);
              overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-item .tag { font-size: 10px; font-weight: 700; text-transform: uppercase;
                letter-spacing: .04em; color: var(--red); }

/* Адрес склада — его копируют в магазин, поэтому моноширинный и
   выделяемый: пробел не на своём месте стоит коробки. */
.wh-text { margin: 7px 0 0; padding: 10px 12px; border-radius: 10px;
           background: var(--band); font-family: ui-monospace, Menlo, monospace;
           font-size: 12px; line-height: 1.5; color: var(--ink);
           white-space: pre-wrap; word-break: break-word; user-select: text;
           cursor: copy; }
.own-row .v.wait { color: var(--muted); font-weight: 600; }

/* Поле с кнопкой: кнопка той же высоты, что и поле, — иначе она висит
   отдельной пилюлей рядом. */
.field-row { display: flex; gap: 8px; margin-top: 8px; }
/* Вид поля задан у .set-row, а это поле вне её — без своих правил оно
   оставалось белым на тёмной теме. */
.field-row input[type="text"] { flex: 1; min-width: 0; margin-top: 0;
                                font-family: inherit; font-size: 13.5px;
                                font-weight: 600; color: var(--ink);
                                background: var(--band); border: 1px solid var(--rule);
                                border-radius: 10px; padding: 11px 12px; }
.field-row input[type="text"]:focus { outline: none; border-color: var(--red); }
.field-row button { flex: 0 0 auto; padding: 0 18px; border-radius: 10px;
                    background: var(--band); font-size: 13px; font-weight: 700;
                    color: var(--ink); }

.date-edit { display: flex; gap: 8px; margin-top: 7px; }
.date-edit input { flex: 1; min-width: 0; }
.date-edit button { padding: 0 14px; border-radius: 10px; background: var(--band);
                    font-size: 12.5px; font-weight: 700; color: var(--ink); }

.row.stacked { flex-wrap: wrap; row-gap: 9px; }
/* Ровно столько, чтобы подпись встала рядом с иконкой, а кнопки — под ними:
   17px иконки плюс 12px отступа. */
.row.stacked .t { flex: 1 1 calc(100% - 29px); }
.row.stacked .seg { margin-left: 29px; }

.own-title { font-size: 22px; font-weight: 800; letter-spacing: -.02em; padding: 0 20px 14px; }
.own-block { margin: 0 20px 18px; }
.own-h { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
         color: var(--faint); margin-bottom: 8px; }
/* ── Заявки на оплату ── */
/* Счётчик у строки в сводке: незакрытая заявка должна попадаться на глаза
   сама, а не ждать, пока про неё вспомнят. */
.row .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 100px;
              background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
              display: inline-flex; align-items: center; justify-content: center;
              font-variant-numeric: tabular-nums; }
.pay-card { border: 1px solid var(--rule); border-radius: 14px; padding: 13px 14px;
            margin-bottom: 10px; }
.pay-card.done { opacity: .6; }
.pay-head { display: flex; align-items: flex-start; gap: 10px; }
.pay-who { flex: 1; min-width: 0; }
.pay-head b { font-size: 14px; }
.pay-head .pill { flex-shrink: 0; font-size: 9.5px; font-weight: 700; padding: 2px 7px;
                  border-radius: 100px; background: var(--band); color: var(--muted);
                  white-space: nowrap; }
.pay-when { margin-top: 2px; font-size: 11.5px; color: var(--faint);
            font-variant-numeric: tabular-nums; }
.pay-card .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pay-card .actions button { flex: 1 1 auto; min-width: 46%; padding: 11px 12px;
                            border-radius: 11px; font-size: 13px; font-weight: 700; }
.pay-card .actions .primary { background: var(--red); color: #fff; }
.pay-card .actions .ghost { border: 1.5px solid var(--rule); color: var(--ink); }
.pay-card .note { margin-top: 10px; padding: 10px 12px; border-radius: 11px;
                  background: var(--band); font-size: 12.5px; color: var(--muted);
                  line-height: 1.5; }

/* Итог рядом с заголовком колоды: сумму долга ищут раньше, чем имена. */
.own-tag { float: right; text-transform: none; letter-spacing: 0; color: var(--red);
           font-variant-numeric: tabular-nums; }
.own-rows { border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; }
/* Строка переносится целиком, а не сдавливает подпись. Длинный «хвост»
   («сборы ≈₽40 000 · за всё время ≈₽230 205») уходит на вторую строку —
   раньше он выжимал подпись до нулевой ширины. */
.own-row { display: flex; align-items: baseline; gap: 10px; padding: 11px 14px;
           font-size: 13px; flex-wrap: wrap; }
.own-row + .own-row { border-top: 1px solid var(--rule); }
/* Подпись не обрезается многоточием («Ушло карго» → «У…») и не
   рассыпается по букве в столбик: break-word, а не anywhere, — anywhere
   разрешает сжать её до одного знака, чем flex немедленно и пользуется.
   Минимум в 8em держит её читаемой, остальное уезжает на вторую строку. */
.own-row .k { flex: 1 1 auto; min-width: min(8em, 100%); overflow-wrap: break-word; }
.own-row .v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.own-row .sub { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
                flex: 1 1 auto; min-width: 0; }
.own-row .v { margin-left: auto; }
.own-empty { padding: 14px; font-size: 12.5px; color: var(--muted); text-align: center; }
/* Экран инвойсов: фильтры и список — по тому же левому краю, что и
   остальное на экране. */
#screen-invoices .chips { margin: 0 20px 10px; }
#screen-invoices .own-rows { margin: 0 20px; }
#screen-invoices .own-row .k .hint { margin-top: 2px; }
/* Лист инвойса в карточке клиента. Он вертикальный и мелкий на телефоне —
   нажатие открывает его целиком тем же просмотром, что и фото посылки. */
.sheet-view { border: 1px solid var(--rule); border-radius: 14px; overflow: hidden;
              background: #fff; }
.sheet-view img { display: block; width: 100%; height: auto; cursor: zoom-in; }
/* Номер посылки рядом с её названием: название главное, номер — чтобы
   сверить с уведомлением. */
.ship-body .num .dim { color: var(--faint); font-weight: 600; }
.own-hint { padding: 0 20px 14px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.stat .v.small { font-size: 17px; }

/* Плашка режима просмотра. Висит поверх всего: забыть, что смотришь чужими
   глазами, и принять чужие цифры за свои — легче, чем кажется. */
/* Над меню, когда оно есть, и просто у нижнего края, когда его нет —
   иначе на экранах без меню плашка висела бы посреди пустоты. */
.banner { position: fixed; left: 12px; right: 12px; z-index: 15;
          bottom: calc(var(--safe-bottom) + 12px);
          display: flex; align-items: center; gap: 9px; padding: 10px 12px;
          border-radius: 12px; background: var(--ink); color: var(--page);
          font-size: 12.5px; font-weight: 600; }
body.with-nav .banner { bottom: calc(var(--nav-h) + var(--safe-bottom) + 10px); }
.banner svg { width: 15px; height: 15px; flex-shrink: 0; }
.banner span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
               white-space: nowrap; }
.banner button { font-size: 11.5px; font-weight: 700; color: var(--page);
                 border: 1px solid rgba(255,255,255,.35); border-radius: 100px;
                 padding: 5px 10px; white-space: nowrap; }
:root[data-theme="dark"] .banner button { border-color: rgba(0,0,0,.35); }

/* Переключатель. Нативный checkbox в Telegram-вебвью выглядит чужеродно
   и по-разному на iOS и Android, поэтому свой. */
.switch { width: 44px; height: 26px; border-radius: 100px; background: var(--rule);
          padding: 3px; flex-shrink: 0; transition: background .18s; }
.switch i { display: block; width: 20px; height: 20px; border-radius: 50%;
            background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
            transition: transform .18s; }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"] i { transform: translateX(18px); }

/* ── Плашки с объявлениями ── */

.promos { display: flex; flex-direction: column; gap: 8px; padding: 0 14px 14px; }
.promo { position: relative; border-radius: 14px; padding: 13px 40px 13px 15px;
         background: var(--tint-truck); border: 1px solid transparent; }
.promo h4 { font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.promo p { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 3px; }
.promo a { display: inline-block; margin-top: 8px; font-size: 12.5px; font-weight: 700;
           color: var(--red); cursor: pointer; }
/* Крестик крупнее, чем выглядит: попасть по нему пальцем надо с первого раза,
   иначе клиент откроет объявление вместо того, чтобы его закрыть. */
.promo .x { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px;
            display: flex; align-items: center; justify-content: center; color: var(--muted); }
.promo .x svg { width: 13px; height: 13px; }

/* ── Отзывы ── */

.reviews { display: flex; flex-direction: column; gap: 12px; padding: 0 20px; }
.review { border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; }
/* Высоту задаёт сама картинка: отзывы — скриншоты переписки, и обрезать
   их рамкой значит обрезать половину текста. */
.review img { display: block; width: 100%; height: auto; background: var(--band); }
.review .body { padding: 12px 14px; font-size: 13px; line-height: 1.5;
                white-space: pre-wrap; }
.review .when { padding: 0 14px 12px; font-size: 11px; color: var(--faint);
                font-variant-numeric: tabular-nums; }
.review img + .when { padding-top: 10px; }

/* ── Графики и карточка клиента ── */

.own-two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.own-two .own-block { margin: 0 0 18px; }
.own-two:first-of-type { padding: 0 20px; }
@media (max-width: 380px) {
  .own-two { grid-template-columns: 1fr; }
}

.chart { border: 1px solid var(--rule); border-radius: 14px; padding: 14px 12px; }
/* Кольцо стояло в паре со вторым, в половину ширины. Второе убрали —
   оставшееся растянулось бы на весь экран и заняло его целиком. */
.chart.solo { max-width: 240px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
/* Подписи берут цвет из темы: заливка литералом читалась бы только в одной. */
.chart text { fill: var(--muted); font-size: 9px; font-weight: 600;
              font-variant-numeric: tabular-nums; }
.chart text.value { fill: var(--ink); font-size: 10px; font-weight: 700; }
.chart text.big { fill: var(--ink); font-size: 15px; font-weight: 800; }
.chart .empty { font-size: 12px; color: var(--muted); text-align: center; padding: 18px 0; }

.legend { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.legend div { display: flex; align-items: center; gap: 7px; font-size: 11.5px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.legend b { margin-left: auto; font-variant-numeric: tabular-nums; }

.stat-grid.tight { padding: 0 0 12px; }
.stat-grid.tight .stat { padding: 10px 12px; }
.stat-grid.tight .v { font-size: 18px; }

.cc-head { padding: 0 20px 14px; }
.cc-sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.own-row.tap { cursor: pointer; }
.own-row .pill { font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 100px;
                 background: var(--band); color: var(--muted); white-space: nowrap;
                 flex-shrink: 0; }
/* Два значка подряд — этап и оплата: вместе они не должны слипаться. */
.own-row .pill + .pill { margin-left: 5px; }
.own-row .pill.paid { background: var(--pill-done-bg); color: var(--green); }
.own-row .pill.off { background: var(--tint-truck); color: var(--red); }

/* ── Настройки в панели ── */

.set-block { margin: 0 20px 18px; }
.set-block .own-h { margin-bottom: 8px; }
.set-card { border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
.set-row + .set-row { border-top: 1px solid var(--rule); }
.set-row .k { flex: 1; font-size: 13px; }
.set-row .hint, .set-wide .hint, .set-block > .hint, .row .hint {
  font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.45;
  font-weight: 400;
}
.set-wide .hint b { font-weight: 700; color: var(--ink);
                    font-variant-numeric: tabular-nums; }
.set-row select, .set-row input[type="text"] {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--band); border: 1px solid var(--rule); border-radius: 9px;
  padding: 7px 9px; max-width: 58%; text-align: right;
}
.set-row input[type="text"] { font-variant-numeric: tabular-nums; }
.set-wide { display: block; padding: 12px 14px; }
.set-wide .k { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.set-wide input[type="text"] { max-width: none; width: 100%; text-align: left;
                               margin-top: 7px; }
.set-error { color: var(--red); font-size: 11.5px; margin-top: 6px; line-height: 1.4; }

.set-pair { display: flex; gap: 8px; margin-top: 7px; }
.set-pair input { flex: 1; min-width: 0; max-width: none; text-align: left; }
.set-wide .unit { font-size: 11px; font-weight: 600; color: var(--muted); }

/* ── Фото посылки ── */

.photos { margin: 16px 20px 0; }
/* Внутри блока отступ от края даёт сам блок. Свой второй сдвигал снимки
   вправо от заголовка, и левый край экрана переставал быть прямым. */
.own-block .photos, .own-block .detail-actions { margin: 10px 0 0; padding: 0; }
.own-block .detail-actions { display: flex; flex-direction: column; gap: 8px; }
.own-block .detail-actions .btn-ghost,
.own-block .detail-actions .btn-outline { margin-top: 0; }

/* Зелёная плашка «подтверждено» — та же, что в блоке оплаты: там она уже
   нарисована, и второй вид того же сообщения был бы просто вторым. */
.own-block .note { font-size: 12px; line-height: 1.5; padding: 9px 11px;
                   border-radius: 10px; background: var(--pill-transit-bg);
                   color: var(--amber); font-weight: 600; }
.own-block .note.done { background: var(--pill-done-bg); color: var(--green); }
.photos h5 { font-size: 11.5px; font-weight: 700; text-transform: uppercase;
             letter-spacing: .08em; color: var(--faint); margin-bottom: 8px; }
/* Лентой вбок: фото обычно два-три, и сеткой они заняли бы пол-экрана
   перед тем, ради чего карточку открыли. */
.photo-strip { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
               padding-bottom: 2px; }
.photo-strip::-webkit-scrollbar { display: none; }
.photo-strip img { width: 104px; height: 104px; object-fit: cover; border-radius: 12px;
                   flex-shrink: 0; background: var(--band); cursor: pointer; }
.lightbox { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.92);
            display: flex; align-items: center; justify-content: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 10px; }
.lightbox .cap { position: absolute; left: 16px; right: 16px;
                 bottom: calc(var(--safe-bottom) + 18px); color: #fff; font-size: 13px;
                 text-align: center; line-height: 1.5; }
.lightbox .x { position: absolute; top: calc(var(--safe-top) + 10px); right: 12px;
               width: 40px; height: 40px; color: #fff; display: flex;
               align-items: center; justify-content: center; }
.lightbox .x svg { width: 18px; height: 18px; }

/* ── Инвойс в панели ── */

#screen-invoice { padding-bottom: calc(var(--safe-bottom) + 24px);
                  padding-top: calc(var(--safe-top) + 16px); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 100px;
                border: 1px solid var(--rule); color: var(--muted); }
.chips button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.set-block .chips { padding: 0; }
.row .r.warn { color: var(--red); font-weight: 700; }
.own-row .v.warn { color: var(--red); }
.row svg.lead.warn { color: var(--red); }

/* Отрисованный лист инвойса. Показываем целиком и по ширине: это документ,
   и обрезать его рамкой значит прятать то, ради чего открыли. */
.sheet img { display: block; width: 100%; height: auto; border-radius: 12px;
             border: 1px solid var(--rule); background: #fff; cursor: zoom-in; }
.sheet .loading { padding: 40px 0; text-align: center; font-size: 12.5px;
                  color: var(--muted); }

/* ── Тексты для клиентов ── */

.set-wide textarea { width: 100%; margin-top: 7px; font-family: inherit; font-size: 13px;
                     line-height: 1.5; color: var(--ink); background: var(--band);
                     border: 1px solid var(--rule); border-radius: 9px; padding: 9px 10px;
                     resize: vertical; min-height: 64px; }
.text-item { padding: 12px 14px; }
.text-item + .text-item { border-top: 1px solid var(--rule); }
.text-item .head { display: flex; align-items: center; gap: 10px; }
.text-item .head .n { font-size: 11.5px; font-weight: 700; color: var(--faint);
                      text-transform: uppercase; letter-spacing: .06em; flex: 1; }
.text-item .head button { font-size: 11.5px; font-weight: 700; color: var(--red); }
.text-item input[type="text"] { width: 100%; max-width: none; text-align: left;
                                margin-top: 7px; font-family: inherit; font-size: 13px;
                                font-weight: 600; color: var(--ink); background: var(--band);
                                border: 1px solid var(--rule); border-radius: 9px; padding: 9px 10px; }
.text-item input[type="text"]::placeholder { color: var(--faint); font-weight: 500; }
.text-item input[type="text"]:focus { outline: none; border-color: var(--red); }
.add-row { padding: 11px 14px; font-size: 13px; font-weight: 700; color: var(--red);
           width: 100%; text-align: left; }
.add-row + .text-item { border-top: 1px solid var(--rule); }

/* ── Оплата ── */

.pay { margin: 18px 20px 0; border: 1px solid var(--rule); border-radius: 14px;
       padding: 14px 15px; }
.pay h5 { font-size: 13.5px; font-weight: 700; margin-bottom: 4px; }
.pay p { font-size: 12px; color: var(--muted); line-height: 1.5; }
.pay .req { margin-top: 10px; background: var(--band); border-radius: 10px;
            padding: 10px 12px; }
.pay .req .t { font-size: 11.5px; font-weight: 700; color: var(--muted); }
/* Реквизиты выделяются одним касанием и переносятся целиком: копировать
   адрес кошелька по частям — верный способ ошибиться. */
.pay .req code { display: block; margin-top: 4px; font-size: 12.5px;
                 line-height: 1.5; word-break: break-all; user-select: all;
                 font-variant-numeric: tabular-nums; }
.pay .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.pay button { padding: 12px; border-radius: 12px; font-size: 13.5px; font-weight: 700; }
.pay .primary { background: var(--red); color: #fff; }
.pay .ghost { border: 1.5px solid var(--rule); color: var(--ink); }
.pay .note { margin-top: 10px; font-size: 12px; line-height: 1.5;
             padding: 9px 11px; border-radius: 10px; background: var(--pill-transit-bg);
             color: var(--amber); font-weight: 600; }
.pay .done { background: var(--pill-done-bg); color: var(--green); }
.pay input[type="file"] { display: none; }

.req-public { display: flex; align-items: center; gap: 7px; margin-top: 8px;
              font-size: 12px; color: var(--muted); cursor: pointer; }
.req-public input { width: 16px; height: 16px; accent-color: var(--red); }

/* Реквизиты в блоке оплаты: «Скопировать» под текстом, дата присылки рядом
   с названием — по ней видно, что это свежие, а не старые из переписки. */
.pay .req .link { margin-top: 6px; padding: 0; background: none; border: 0; color: var(--red);
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.pay .req .t .sub { font-weight: 500; color: var(--muted); }

/* Подсказка городов под полем «Город» в форме посылки */
.city-sug { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 12px; }
.city-sug[hidden] { display: none; }
.city-sug button {
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--band); border: 1px solid var(--rule); border-radius: 999px;
  padding: 6px 12px; cursor: pointer;
}
.city-sug button:active { border-color: var(--red); color: var(--red); }

/* Услуга каталога: название и переключатель «Активна» в одну строку */
.svc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Выбор способа оплаты */
.pay-methods { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.pay-method {
  font-family: inherit; font-size: 14px; font-weight: 700; color: var(--ink);
  background: var(--band); border: 1.5px solid var(--rule); border-radius: 12px; padding: 10px 14px;
}
.pay-method.on { border-color: var(--red); color: var(--red); }
.req-method { font: inherit; font-size: 13px; margin-left: 6px; }

/* Фото к реквизитам (QR-код): у клиента — крупно и по нажатию в полный
   размер, в настройках — миниатюра с «Убрать фото». */
.pay .req .req-qr { display: block; margin-top: 8px; }
.pay .req .req-qr img { display: block; width: 100%; max-width: 240px; border-radius: 10px;
                        background: #fff; }
.req-photo { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.req-photo img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #fff; }
.req-photo button { background: none; border: 0; padding: 0; color: var(--red); font: inherit;
                    font-size: 13px; cursor: pointer; }
.req-photo-add { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--red);
                 font-weight: 600; cursor: pointer; }

/* Порядок способов оплаты: первый — без стрелки, остальные поднимаются нажатием */
.pay-order { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.po-item { font: inherit; font-size: 12.5px; padding: 5px 10px; border-radius: 999px;
           border: 1px solid var(--line, #ddd); background: var(--band); color: inherit; cursor: pointer; }
.po-item:disabled { background: var(--red); color: #fff; border-color: var(--red); cursor: default; opacity: 1; }

/* Номер инвойса для комментария к платежу — над реквизитами, заметнее их */
.pay .req.pay-ref { border: 1.5px dashed var(--red); }
.pay .req.pay-ref code { font-size: 15px; font-weight: 700; }
.pay .req.pay-ref .sub { margin-top: 6px; font-size: 11.5px; color: var(--muted); }

/* Кнопка платёжного сервиса: значок, название, комиссия мелко */
.pay .pay-provider { display: flex; align-items: center; justify-content: center; gap: 8px; }
.pay .pay-provider img { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.pay .pay-provider small { display: block; margin-top: 1px; font-size: 11.5px; font-weight: 500; opacity: .8; }
.pay .pay-provider span { text-align: left; line-height: 1.25; }

.pickup { margin: 4px 16px 12px; padding: 12px 14px; border-radius: 12px;
  background: var(--band); color: var(--ink); white-space: pre-line; font-size: 14px; line-height: 1.4; }

/* Доставка по России: сохранённые адреса и пометка про курьера */
.addr-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px 4px; }
.addr-chip { display: inline-flex; align-items: center; background: var(--band);
  border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }
.addr-chip button { font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  background: none; border: 0; padding: 6px 4px 6px 12px; cursor: pointer; }
.addr-chip button.x { padding: 6px 10px 6px 6px; color: var(--muted); font-size: 15px; }
.addr-chip button:active { color: var(--red); }
.pf-note { padding: 0 14px 12px; font-size: 12.5px; color: var(--muted); }
.pf-note a { color: var(--red); font-weight: 600; text-decoration: none; }

/* Фото посылки в карточке инвойса */
.inv-photos { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 20px 8px; }
.inv-photo { position: relative; width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: var(--band); }
.inv-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inv-photo button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 14px; line-height: 22px; padding: 0; }
.inv-photo-add { width: 76px; height: 76px; border-radius: 10px; border: 1.5px dashed var(--rule);
  background: none; color: var(--red); font: inherit; font-size: 13px; font-weight: 700; }
/* Долг карго: кнопка «Оплачено» в строке */
.mini-btn { margin-left: 10px; font: inherit; font-size: 12px; font-weight: 700; color: var(--red);
  background: none; border: 1px solid var(--rule); border-radius: 100px; padding: 5px 10px; }
.pay .req.pay-sum code { font-size: 22px; font-weight: 800; }
