:root {
  --bg: #F1F3F5;
  --card: #FFFFFF;
  --ink: #0F172A;
  --text-2: #3D4654;
  --muted: #5B6472;
  --line: #E2E5EA;
  --line-soft: #EEF0F3;
  --soft: #F7F8FA;
  --field-border: #D5D9DF;
  --tabs-bg: #E4E7EB;
  --strong: #0F172A;
  --strong-hover: #1E293B;
  --on-strong: #FFFFFF;
  --deep: #0F172A;
  --on-deep: #FFFFFF;
  --on-deep-2: #CBD2DC;
  --accent: #C2410C;
  --accent-hover: #9A3412;
  --accent-text: #C2410C;
  --accent-dot: #E8590C;
  --accent-soft: #FFF1E8;
  --link: #C2410C;
  --link-hover: #9A3412;
  --ok: #15803D;
  --ok-text: #166534;
  --ok-soft: #ECF7EF;
  --info: #1E3A8A;
  --info-soft: #E3EAFE;
  --danger: #B91C1C;
  --danger-strong: #B91C1C;
  --danger-soft: #FDECEC;
  --av0-bg: #DCE6FF; --av0: #1E3A8A;
  --av1-bg: #E3F2E7; --av1: #14532D;
  --av2-bg: #FEF3C7; --av2: #78350F;
  --av3-bg: #FDE7F0; --av3: #831843;
  --shadow: rgba(15, 23, 42, .08);
  --radius: 20px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Unbounded', var(--font);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 28px; font-weight: 800; }
h2, .h2 { font-size: 19px; font-weight: 800; }
h3 { font-size: 17px; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 14px 0; }
code { font-size: 13px; background: var(--soft); padding: 2px 6px; border-radius: 6px; }
:focus-visible { outline: 3px solid #2457FF; outline-offset: 2px; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 1360px; }
.page { padding-top: 28px; padding-bottom: 64px; min-height: 70vh; }
.narrow { max-width: 680px; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.mt { margin-top: 12px; }

/* Шапка */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding-top: 12px; padding-bottom: 12px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-family: 'Fredoka', var(--font); font-weight: 600; font-size: 25px; line-height: 1; letter-spacing: -.02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.logo-line { fill: none; stroke: currentColor; stroke-width: 10; stroke-linecap: round; stroke-linejoin: round; }
.logo-heart { fill: var(--accent-dot); }
.logo-dot { width: .44em; height: .39em; margin: 0 .03em; vertical-align: -.02em; }
@media (max-width: 480px) { .logo { font-size: 21px; } .logo-mark { display: none; } }
.nav { display: flex; flex-wrap: wrap; gap: 4px 20px; flex: 1; }
.nav-link { color: var(--text-2); font-weight: 600; text-decoration: none; padding: 8px 0; }
.nav-link.is-active { color: var(--ink); font-weight: 800; box-shadow: inset 0 -2px 0 var(--accent-dot); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.show-sm { display: none; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px;
  border: 1px solid transparent; font: 700 15px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-dark { background: var(--strong); color: var(--on-strong); }
.btn-dark:hover { background: var(--strong-hover); color: var(--on-strong); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--field-border); }
.btn-ghost:hover { background: var(--soft); color: var(--ink); }
.btn-danger { background: var(--danger-strong); color: #fff; }
.btn-link { background: none; border: 0; padding: 8px 0; font: 600 14px var(--font); color: var(--text-2); text-decoration: underline; cursor: pointer; }
.inline { display: inline; }

/* Текст */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 800; }
.block { display: block; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.accent-text { color: var(--accent-text); }
.ok-text { color: var(--ok); }
.danger-text { color: var(--danger) !important; }
.hint { font-size: 13px; color: var(--text-2); margin: 0; }
.pre { white-space: pre-line; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Карточки и бейджи */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; }
.badge { display: inline-block; border-radius: 9px; padding: 4px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-ok { background: var(--ok-soft); color: var(--ok-text); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--line-soft); color: var(--text-2); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { background: var(--bg); border-radius: 8px; padding: 4px 10px; font-size: 13px; font-weight: 600; }
.flash { border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
.flash-ok { background: var(--ok-soft); color: var(--ok-text); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--info-soft); color: var(--info); }
.card .flash:last-child { margin-bottom: 0; }
.empty { background: var(--card); border-radius: var(--radius); padding: 32px 20px; text-align: center; color: var(--text-2); display: flex; flex-direction: column; gap: 14px; align-items: center; }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-0 { background: var(--av0-bg); color: var(--av0); }
.avatar-1 { background: var(--av1-bg); color: var(--av1); }
.avatar-2 { background: var(--av2-bg); color: var(--av2); }
.avatar-3 { background: var(--av3-bg); color: var(--av3); }
.user-inline { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }

.price { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.01em; white-space: nowrap; }
.route { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.route-arrow { color: var(--accent-dot); }
.h-route { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row-between.wrap { flex-wrap: wrap; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--text-2); margin-bottom: 16px; }
.crumbs a { color: var(--text-2); }

/* Главная */
.hero { padding: 12px 0 28px; }
.hero h1 { font-family: var(--display); font-size: clamp(28px, 4.4vw, 44px); letter-spacing: -.02em; max-width: 820px; }
.lead { font-size: 18px; color: var(--text-2); max-width: 640px; }
.search { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; box-shadow: 0 10px 30px var(--shadow); }
.search-field { flex: 1 1 180px; display: flex; flex-direction: column; background: var(--soft); border-radius: 14px; padding: 8px 14px; }
.search-field-sm { flex: 1 1 120px; }
.search-field span { font-size: 12px; color: var(--muted); }
.search-field input, .search-field select { border: 0; background: transparent; padding: 2px 0; font: 700 16px var(--font); color: var(--ink); outline: none; width: 100%; }
.search .btn { flex: 0 1 150px; min-height: 58px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin: 28px 0 14px; }
.section-head h2 { margin: 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.parcel-card { display: flex; flex-direction: column; gap: 12px; color: var(--ink); text-decoration: none; transition: box-shadow .15s; }
.parcel-card:hover { color: var(--ink); box-shadow: 0 8px 24px var(--shadow); }
.parcel-card-top { display: flex; justify-content: space-between; gap: 12px; }
.parcel-card-route { display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.parcel-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 12px; font-size: 13px; }
.trust { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; background: var(--deep); color: var(--on-deep); border-radius: 24px; padding: 32px; margin-top: 40px; }
.trust p { color: var(--on-deep-2); margin: 0; }

/* Формы */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; min-width: 0; }
.field input, .field select, .field textarea, .inline-form > input, .chat-form input, .inline-form select {
  width: 100%; min-height: 48px; border: 1px solid var(--field-border); border-radius: 14px; background: var(--card);
  padding: 10px 14px; font: 500 16px var(--font); color: var(--ink); }
.field textarea { min-height: 0; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .chat-form input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--shadow); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 600; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); flex-shrink: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-form .field { flex: 1 1 180px; }
.inline-form > input { flex: 1 1 160px; width: auto; }
.inline-form select { width: auto; min-height: 40px; padding: 6px 10px; }
.field-price input, .input-price { font-family: var(--display); font-size: 22px; font-weight: 700; }
.input-code { font-family: var(--display); font-size: 24px; letter-spacing: .3em; text-align: center; }
.auth-box { max-width: 460px; margin: 20px auto; display: flex; flex-direction: column; gap: 14px; }
.methods { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.methods legend { font-weight: 800; margin-bottom: 10px; padding: 0; }
.method { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); cursor: pointer; }
.method:has(input:checked) { border: 2px solid var(--ink); }
.method input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); }

/* Посылка, сделка */
.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split-main { flex: 999 1 560px; min-width: 0; }
.split-side { flex: 1 1 320px; min-width: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; margin: 20px 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 800; }
.user-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.panel { display: flex; flex-direction: column; gap: 14px; }
.panel h2 { margin: 0; }
.offer { display: flex; flex-direction: column; gap: 12px; }
.offer.is-dim { opacity: .65; }
.offer-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.offer-comment { background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 0; }
.code-card { background: var(--deep); color: var(--on-deep); }
.code-card p { color: var(--on-deep-2); font-size: 14px; margin: 12px 0 0; }
.code { font-family: var(--display); font-size: 32px; font-weight: 700; letter-spacing: .2em; }

.timeline { list-style: none; margin: 16px 0 0; padding: 0; }
.timeline li { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:not(:last-child)::before { content: ''; position: absolute; left: 10px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.timeline .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--field-border); background: var(--card); flex-shrink: 0; position: relative; z-index: 1; }
.timeline .is-done .dot { background: var(--ok); border-color: var(--ok); }
.timeline .is-done:not(:last-child)::before { background: var(--ok); }
.timeline .is-current .dot { border: 4px solid var(--accent-dot); }
.timeline .is-current b { color: var(--accent-text); }
.timeline .is-cancelled .dot { background: var(--danger-strong); border-color: var(--danger-strong); }

.chat { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.msg { align-self: flex-start; max-width: 82%; }
.msg.is-mine { align-self: flex-end; }
.msg-meta { font-size: 12px; color: var(--muted); padding: 0 6px 2px; }
.msg-body { background: var(--soft); border-radius: 16px 16px 16px 4px; padding: 10px 14px; white-space: pre-line; overflow-wrap: anywhere; }
.msg.is-mine .msg-body { background: var(--strong); color: var(--on-strong); border-radius: 16px 16px 4px 16px; }
.msg.is-staff:not(.is-mine) .msg-body { background: var(--info-soft); }
.msg-system { align-self: center; text-align: center; font-size: 13px; color: var(--text-2); background: var(--accent-soft); border-radius: 10px; padding: 6px 12px; max-width: 90%; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; min-width: 0; }

.stars-input { border: 0; padding: 0; margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.stars-input label { cursor: pointer; }
.stars-input input { position: absolute; opacity: 0; }
.stars-input span { display: inline-block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-weight: 700; }
.stars-input input:checked + span { background: var(--strong); color: var(--on-strong); border-color: var(--strong); }
.stars-input input:focus-visible + span { outline: 3px solid #2457FF; }

/* Списки */
.list { padding: 4px 20px; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { color: var(--ink); background: linear-gradient(90deg, transparent, var(--soft), transparent); }
a.card.list-row { padding: 16px 20px; }

/* Профиль, верификация */
.profile-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 24px; }
.profile-head > div { flex: 1 1 260px; }
.profile-head h1 { margin-bottom: 6px; }
.review-head { display: flex; justify-content: space-between; gap: 12px; }
.review p { margin: 8px 0; }
.levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.level { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.level span { height: 6px; border-radius: 3px; background: var(--field-border); }
.level.is-done span { background: var(--ok); }
.level.is-current span { background: var(--accent-dot); }
.level small { color: var(--muted); }
.big-check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 32px; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.prose { max-width: 760px; margin: 0 auto; }
.prose h2 { margin-top: 24px; }
.prose li { margin-bottom: 6px; }

/* Админка */
.admin { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.admin-nav { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; padding: 14px; }
.admin-nav a { color: var(--text-2); text-decoration: none; font-weight: 600; padding: 10px 12px; border-radius: 12px; display: flex; justify-content: space-between; }
.admin-nav a.is-active { background: var(--strong); color: var(--on-strong); font-weight: 800; }
.admin-nav .count { background: var(--accent); color: #fff; border-radius: 8px; padding: 0 8px; font-size: 12px; font-weight: 800; }
.admin-main { flex: 999 1 640px; min-width: 0; }
.admin-main h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat-value { font-family: var(--display); font-weight: 700; font-size: 26px; margin-top: 4px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
thead th { color: var(--text-2); font-size: 13px; border-bottom-color: var(--line); white-space: nowrap; }
.matrix td { text-align: center; }
.matrix th[scope=row] { font-weight: 600; }
.tabs { display: flex; gap: 4px; background: var(--tabs-bg); border-radius: 12px; padding: 4px; }
.tabs a { padding: 6px 12px; border-radius: 9px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 14px; }
.tabs a.is-active { background: var(--card); color: var(--ink); font-weight: 800; }

/* Ошибки, подвал */
.error-card { max-width: 560px; margin: 40px auto; text-align: center; }
.error-code { font-family: var(--display); font-size: 56px; font-weight: 700; color: var(--accent-dot); }
.footer { border-top: 1px solid var(--line); background: var(--card); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 20px; padding-bottom: 20px; font-size: 14px; color: var(--text-2); }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-links a { color: var(--text-2); }

@media (max-width: 640px) {
  .container { padding: 0 14px; }
  .page { padding-top: 18px; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .topbar-inner { flex-wrap: wrap; }
  .topbar-actions { gap: 6px; }
  .topbar-inner { gap: 8px 16px; }
  .nav { order: 3; flex-basis: 100%; gap: 4px 16px; font-size: 15px; }
  .topbar-actions { margin-left: auto; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; border-radius: 18px; }
  .search .btn { flex-basis: 100%; }
  .h-route { font-size: 21px; }
  .trust { padding: 22px; }
  .list { padding: 2px 16px; }
}

/* Установщик */
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }

/* Тёмная тема: по настройке системы или по выбору пользователя (data-theme на <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #0D1219;
  --card: #161D28;
  --ink: #E8EDF3;
  --text-2: #B3BDCA;
  --muted: #8F9AAA;
  --line: #2A3445;
  --line-soft: #202936;
  --soft: #1C2532;
  --field-border: #3A4556;
  --tabs-bg: #0D1219;
  --strong: #E8EDF3;
  --strong-hover: #FFFFFF;
  --on-strong: #0F172A;
  --deep: #1F2937;
  --on-deep: #F1F5F9;
  --on-deep-2: #B9C3D0;
  --accent: #C2410C;
  --accent-hover: #EA580C;
  --accent-text: #FB923C;
  --accent-dot: #F97316;
  --accent-soft: #3A2114;
  --link: #FB923C;
  --link-hover: #FDBA74;
  --ok: #16A34A;
  --ok-text: #4ADE80;
  --ok-soft: #10291A;
  --info: #9DB8FF;
  --info-soft: #1A2745;
  --danger: #F87171;
  --danger-strong: #B91C1C;
  --danger-soft: #3B1518;
  --av0-bg: #1E2E57; --av0: #BFD0FF;
  --av1-bg: #163522; --av1: #A7E8BC;
  --av2-bg: #3E2D0C; --av2: #FCD98A;
  --av3-bg: #44162B; --av3: #F9B4D0;
  --shadow: rgba(0, 0, 0, .35);
  color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1219;
  --card: #161D28;
  --ink: #E8EDF3;
  --text-2: #B3BDCA;
  --muted: #8F9AAA;
  --line: #2A3445;
  --line-soft: #202936;
  --soft: #1C2532;
  --field-border: #3A4556;
  --tabs-bg: #0D1219;
  --strong: #E8EDF3;
  --strong-hover: #FFFFFF;
  --on-strong: #0F172A;
  --deep: #1F2937;
  --on-deep: #F1F5F9;
  --on-deep-2: #B9C3D0;
  --accent: #C2410C;
  --accent-hover: #EA580C;
  --accent-text: #FB923C;
  --accent-dot: #F97316;
  --accent-soft: #3A2114;
  --link: #FB923C;
  --link-hover: #FDBA74;
  --ok: #16A34A;
  --ok-text: #4ADE80;
  --ok-soft: #10291A;
  --info: #9DB8FF;
  --info-soft: #1A2745;
  --danger: #F87171;
  --danger-strong: #B91C1C;
  --danger-soft: #3B1518;
  --av0-bg: #1E2E57; --av0: #BFD0FF;
  --av1-bg: #163522; --av1: #A7E8BC;
  --av2-bg: #3E2D0C; --av2: #FCD98A;
  --av3-bg: #44162B; --av3: #F9B4D0;
  --shadow: rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* Переключатели в шапке */
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--field-border); background: var(--card); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.menu-pop { position: relative; }
.menu-pop > summary { list-style: none; cursor: pointer; }
.menu-pop > summary::-webkit-details-marker { display: none; }
.lang-menu > summary { min-width: 44px; height: 40px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--field-border); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 32px var(--shadow); padding: 6px; display: flex; flex-direction: column; }
.menu-list a { padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; }
.menu-list a:hover, .menu-list a[aria-current] { background: var(--soft); color: var(--ink); }
.menu-list a[aria-current] { font-weight: 800; }

/* Посылки / Поездки */
.kind-tabs { display: inline-flex; gap: 4px; background: var(--tabs-bg); border-radius: 14px; padding: 4px; margin: 4px 0 14px; }
.kind-tabs a { padding: 9px 18px; border-radius: 11px; color: var(--text-2); text-decoration: none; font-weight: 700; }
.kind-tabs a.is-active { background: var(--card); color: var(--ink); font-weight: 800; box-shadow: 0 1px 3px var(--shadow); }
.chip-soft { background: var(--accent-soft); color: var(--accent-text); }
.translated { background: var(--soft); border-radius: 12px; padding: 10px 14px; margin-top: 8px; }
.translated p { margin: 4px 0 0; }
.row-center { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
@media (max-width: 900px) { .hide-md { display: none; } }

/* Подсказки городов */
.city-field { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 25; list-style: none; margin: 0; padding: 6px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px var(--shadow); max-height: 320px; overflow-y: auto; }
.ac-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--ink); }
.ac-item mark { background: none; color: var(--accent-text); font-weight: 800; }
.ac-item[aria-selected="true"], .ac-item:hover { background: var(--soft); }
.ac-empty { padding: 10px 12px; font-size: 14px; color: var(--muted); font-weight: 500; }
.search-field label { display: flex; flex-direction: column; }

/* Верификация перевозчика */
.role-pick .method b { font-size: 16px; }
.car-row { display: flex; gap: 14px; align-items: center; }
.car-row:not(.card) { margin: 14px 0; }
.car-photo { width: 120px; height: 84px; object-fit: cover; border-radius: 12px; background: var(--soft); flex: none; }
.car-photo-wide { display: block; width: 100%; max-width: 420px; height: auto; aspect-ratio: 3 / 2; margin-top: 14px; }
.plate { display: inline-block; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 700; letter-spacing: .06em; padding: 3px 10px; border: 2px solid var(--ink); border-radius: 6px; background: var(--card); color: var(--ink); margin-top: 4px; white-space: nowrap; }
.input-plate { text-transform: uppercase; font-family: ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .06em; }
.upload-field input[type=file] { padding: 10px; min-height: 0; cursor: pointer; }
.upload-field input[type=file]::file-selector-button { border: 0; border-radius: 10px; padding: 8px 14px; margin-right: 12px; background: var(--strong); color: var(--on-strong); font: inherit; font-weight: 700; cursor: pointer; }
.upload-field .upload-status { font-size: 13px; color: var(--muted); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.doc { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.doc a { display: block; }
.doc img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); }
.doc-missing { aspect-ratio: 4 / 3; display: grid; place-items: center; border-radius: 10px; border: 1px dashed var(--danger); color: var(--danger); background: var(--danger-soft); }
@media (max-width: 480px) { .car-photo { width: 96px; height: 68px; } }

/* Телефон: код страны + номер */
.phone-input { display: grid; grid-template-columns: minmax(0, 11rem) 1fr; gap: 8px; }
.phone-input select { min-width: 0; }
@media (max-width: 480px) { .phone-input { grid-template-columns: minmax(0, 8.5rem) 1fr; } }

/* Комиссия и трек-номер */
.money-rows { margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.money-rows div { display: flex; justify-content: space-between; gap: 12px; }
.money-rows dt { color: var(--muted); }
.money-rows dd { margin: 0; font-weight: 700; white-space: nowrap; }
.money-rows .is-total { border-top: 1px dashed var(--line); padding-top: 6px; }
.money-rows .is-total dt { color: var(--ink); font-weight: 700; }
.track-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 6px 0 12px; }
.track { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 700; letter-spacing: .04em; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; color: var(--ink); }
.alert-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: start; }

.track-search { display: flex; gap: 8px; flex-wrap: wrap; }
.track-search input { flex: 1 1 220px; min-width: 0; text-transform: uppercase; font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.nav-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 12px; line-height: 20px; text-align: center; font-weight: 800; }
.stack-tight { gap: 6px; }
.alert-actions { min-width: 220px; gap: 8px; }
@media (max-width: 640px) { .alert-row { grid-template-columns: minmax(0, 1fr); } .alert-actions { min-width: 0; } }
.track-search input, .alert-actions input { min-height: 46px; box-sizing: border-box; border: 1px solid var(--field-border); border-radius: 12px; padding: 0 14px; font: inherit; background: var(--card); color: var(--ink); }
.track-search input { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 18px; letter-spacing: .04em; }
.track-search select { min-height: 46px; border: 1px solid var(--field-border); border-radius: 12px; padding: 0 10px; font: inherit; background: var(--card); color: var(--ink); }
.alert-actions input { min-height: 40px; font-size: 14px; }

/* Уведомления */
.notif-menu > summary { position: relative; }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: 10px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; border: 2px solid var(--card); }
.bell-count[hidden] { display: none; }
.notif-pop { width: 380px; max-width: calc(100vw - 24px); padding: 8px; gap: 2px; }
.notif-pop-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 8px 8px; }
.notif-pop-head form { margin: 0; }
.menu-list a.notif, .notif { display: grid; grid-template-columns: 36px minmax(0, 1fr) 10px; gap: 10px; align-items: start; padding: 10px; border-radius: 12px;
  color: var(--ink); text-decoration: none; white-space: normal; font-weight: 400; }
.notif:hover { background: var(--soft); }
.notif.is-unread { background: var(--accent-soft); }
.notif.is-unread:hover { background: var(--soft); }
.notif-icon { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--soft); color: var(--text-2); }
.notif-offer { color: var(--accent-text); }
.notif-chat { color: var(--info); }
.notif-verify { color: var(--ok-text); }
.notif-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-context { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: none; }
.notif-title { font-size: 14px; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.notif.is-compact .notif-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-time { font-size: 12px; color: var(--muted); }
.notif-dot { width: 10px; height: 10px; border-radius: 5px; background: var(--accent-dot); margin-top: 6px; }
.notif-empty { padding: 8px 10px 12px; margin: 0; }
.menu-list a.notif-all { text-align: center; font-weight: 700; color: var(--link); border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; margin-top: 4px; }
.notif-list { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
@media (max-width: 520px) {
  .notif-menu { position: static; }
  .notif-pop { left: 12px; right: 12px; width: auto; max-width: none; top: calc(100% - 4px); }
}

/* ---------- Компактное меню: одна строка в шапке, меню аккаунта, нижняя панель на телефоне ---------- */
.topbar-inner { flex-wrap: nowrap; gap: 20px; min-height: 64px; padding-top: 10px; padding-bottom: 10px; }
.nav { flex: 1 1 auto; flex-wrap: nowrap; gap: 2px; min-width: 0; overflow: hidden; }
.nav-link { padding: 8px 10px; border-radius: 10px; white-space: nowrap; box-shadow: none; }
.nav-link:hover { background: var(--soft); color: var(--ink); }
.nav-link.is-active { background: var(--soft); box-shadow: none; }
.topbar-actions { flex: none; margin-left: auto; gap: 8px; }
.create-top > summary { gap: 6px; padding-left: 12px; padding-right: 14px; }
.menu-list a, .menu-btn { display: flex; align-items: center; gap: 10px; }
.menu-list svg { flex: none; color: var(--muted); }
.menu-btn { width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-align: left; }
.menu-btn:hover { background: var(--soft); }
.menu-list form { margin: 0; }
.account-btn { position: relative; display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 0 6px 0 3px; border: 1px solid var(--field-border); border-radius: 22px; background: var(--card); color: var(--muted); }
.account-btn:hover { background: var(--soft); }
.account-dot { position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 5px; background: var(--danger); border: 2px solid var(--card); }
.account-pop { min-width: 260px; }
.account-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.account-head .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-top: 1px solid var(--line); margin-top: 4px; }
.account-row svg { color: var(--muted); }
.seg { display: inline-flex; gap: 2px; background: var(--soft); border-radius: 10px; padding: 3px; }
.menu-list .seg a { padding: 5px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.menu-list .seg a[aria-current] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px var(--shadow); }
.footer-inner { padding-top: 14px; padding-bottom: 14px; font-size: 13px; align-items: center; }
.footer-links { gap: 6px 18px; align-items: center; }
.footer-lang { display: inline-flex; gap: 10px; }
.footer-lang a[aria-current] { color: var(--ink); font-weight: 800; text-decoration: none; }

.tabbar { display: none; }
@media (max-width: 860px) {
  .nav, .create-top { display: none; }
  .topbar-inner { gap: 10px; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--card); border-top: 1px solid var(--line); padding: 0 4px env(safe-area-inset-bottom); box-shadow: 0 -6px 24px var(--shadow); }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 60px; padding: 6px 2px;
    font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; text-align: center; line-height: 1.1; cursor: pointer; list-style: none; }
  .tab::-webkit-details-marker { display: none; }
  .tab.is-active { color: var(--ink); }
  .tab.is-active .tab-icon { color: var(--accent-text); }
  .tab-icon { position: relative; display: inline-flex; }
  .tab-count { position: absolute; top: -6px; right: -10px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; line-height: 18px; }
  .tab-plus { width: 44px; height: 44px; margin-top: -20px; border-radius: 16px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(194, 65, 12, .35); }
  .create-tab { position: relative; }
  .create-tab .menu-list { top: auto; bottom: calc(100% + 10px); left: 50%; right: auto; transform: translateX(-50%); }
  .notif-pop, .account-pop { position: fixed; left: 12px; right: 12px; top: 62px; width: auto; max-width: none; max-height: calc(100vh - 150px); overflow-y: auto; }
  .notif-menu, .account-menu { position: static; }
  .admin { gap: 12px; }
  .admin-nav { flex: 1 1 100%; flex-direction: row; overflow-x: auto; padding: 6px; gap: 4px; scrollbar-width: none; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav > .muted { display: none; }
  .admin-nav a { white-space: nowrap; flex: none; padding: 8px 12px; gap: 6px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
}
@media (max-width: 860px) and (min-width: 481px) { .logo-mark { display: block; } }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.row-wrap form { margin: 0; }
.outbox-error { margin-top: 6px; max-width: 320px; overflow-wrap: anywhere; }
