/* Шрифт Manrope (SIL OFL 1.1) раздаётся с нашего сервера — без запросов к Google Fonts */
/* manrope-cyrillic-ext-wght-normal */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/manrope-cyrillic-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;
}
/* manrope-cyrillic-wght-normal */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/manrope-cyrillic-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}
/* manrope-latin-ext-wght-normal */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/manrope-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
/* manrope-latin-wght-normal */
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/manrope-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* DLZ Logistik — дизайн-система. Mobile-first: базовые стили для телефона, расширения — в media-запросах. */
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --border: #e1e6ef;
  --text: #0f1a33;
  --muted: #5f6b85;
  --navy: #0a1633;
  --navy-2: #13254f;
  --brand: #1f5eff;
  --brand-dark: #1446c9;
  --brand-soft: #e8efff;
  --accent: #ff6a1a;
  --accent-dark: #e65408;
  --accent-soft: #fff1e8;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(10, 22, 51, .05), 0 8px 24px rgba(10, 22, 51, .06);
  --shadow-lg: 0 24px 60px rgba(10, 22, 51, .18);
  --gutter: 16px;
  --bottom-nav: 0px;
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.55; overflow-x: hidden; }
img { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.icon { width: 22px; height: 22px; flex: none; }

/* ---------- Шапка ---------- */
.topbar {
  background: rgba(10, 22, 51, .96); backdrop-filter: blur(10px); color: #fff;
  padding: 0 var(--gutter); height: 60px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 30;
}
.logo { font-weight: 800; font-size: 19px; letter-spacing: .3px; color: #fff; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo span { color: var(--accent); }
.logo .mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #ff9a4d); display: grid; place-items: center; }
.logo .mark svg { width: 20px; height: 20px; color: #fff; }
.topbar .user { font-size: 13px; opacity: .85; display: none; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.25); background: transparent; }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.08); }
.nav-links { display: none; gap: 22px; }
.nav-links a { color: rgba(255,255,255,.8); font-weight: 600; font-size: 14px; }
.nav-links a:hover { color: #fff; }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--brand); background: var(--brand);
  color: #fff; font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; transition: background .15s, transform .05s;
  text-align: center; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: var(--surface); color: var(--brand); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-white { background: #fff; color: var(--navy); border-color: #fff; }
.btn-white:hover { background: #f0f3f9; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 12px;
  font: inherit; font-size: 16px; /* 16px — чтобы iOS не зумил поле */ color: var(--text); background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--brand-soft); border-color: var(--brand); }
textarea { resize: vertical; min-height: 80px; }
.check {
  display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); font-weight: 600; cursor: pointer;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); margin: 0; user-select: none;
}
.check input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--brand); }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.field { margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 16px; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px var(--gutter); }
.stat { padding: 16px 18px; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 4px; }
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 700; background: var(--surface-2); }
th:first-child { border-top-left-radius: 8px; } th:last-child { border-top-right-radius: 8px; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--brand-soft); }
td.num, th.num { text-align: right; }

/* ---------- Статусы ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.st-new { background: #e0ecff; color: #1d4ed8; }
.st-quoted { background: #fff3d6; color: #a16207; }
.st-confirmed, .st-carrier_assigned { background: #ede7ff; color: #6d28d9; }
.st-loading, .st-in_transit { background: #dff5ff; color: #0369a1; }
.st-delivered, .st-closed { background: #dcfce7; color: #15803d; }
.st-cancelled { background: #fee2e2; color: #b91c1c; }

/* ---------- Калькулятор ---------- */
.calc-grid { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
.calc-grid .wide, .calc-grid .wide-sm { grid-column: 1 / -1; }
details.field summary { list-style: none; }
details.field summary::-webkit-details-marker { display: none; }
details.field summary::before { content: "＋ "; }
details[open].field summary::before { content: "－ "; }
.route-swap { display: grid; grid-template-columns: 1fr; gap: 0; }
.calc-result:empty { display: none; }
.quote { border-radius: var(--radius); background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; padding: 18px; }
.quote .muted { color: rgba(255,255,255,.7); }
.quote-total { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.quote .quote-total { color: #fff; }
.quote-lines { list-style: none; padding: 0; margin: 14px 0; font-size: 14px; }
.quote-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed rgba(255,255,255,.18); }
.quote-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.quote-meta div { background: rgba(255,255,255,.08); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.quote-meta strong { display: block; font-size: 15px; }
.quote-actions { display: grid; gap: 8px; margin-top: 14px; }
.calc-error { background: #fee2e2; color: #991b1b; padding: 12px 14px; border-radius: 12px; font-size: 14px; }

/* ---------- Вкладки ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 12px 16px; border: none; background: none; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tab .icon { width: 20px; height: 20px; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Нижняя навигация кабинета на телефоне */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0; border: none;
  background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
.bottom-nav .tab { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 2px; border: none; border-radius: 10px; position: relative; }
.bottom-nav .tab .icon { width: 24px; height: 24px; }
.bottom-nav .tab.active { background: var(--brand-soft); }
.bottom-nav .count { position: absolute; top: 2px; left: 55%; margin: 0; }
body.has-bottom-nav { --bottom-nav: 72px; padding-bottom: calc(var(--bottom-nav) + env(safe-area-inset-bottom)); }

/* ---------- Админка: сайдбар ---------- */
.layout { display: block; min-height: calc(100vh - 60px); }
.sidebar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px; display: flex; overflow-x: auto; gap: 4px; position: sticky; top: 60px; z-index: 20; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.sidebar button { flex: none; text-align: left; padding: 9px 12px; border: none; background: none; border-radius: 10px; font: inherit; font-weight: 600; font-size: 14px; color: var(--text); cursor: pointer; white-space: nowrap; }
.sidebar button:hover { background: var(--surface-2); }
.sidebar button.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.main { padding: 16px var(--gutter); min-width: 0; }

/* ---------- Модальные окна: на телефоне — «шторка» снизу ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 22, 51, .5); z-index: 60; display: flex; justify-content: center; align-items: flex-end; overflow-y: auto; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 20px 20px 0 0; width: 100%; max-height: 94dvh; overflow-y: auto; padding: 20px var(--gutter) calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: up .2s ease; }
.modal { position: relative; }
.modal-head { display: flex; align-items: center; gap: 8px 10px; margin-bottom: 16px; flex-wrap: wrap; padding-right: 44px; min-height: 36px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.close { position: absolute; top: 16px; right: 16px; background: var(--surface-2); border: none; width: 36px; height: 36px; border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }

/* ---------- Таймлайн ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px 14px; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.timeline .internal { color: var(--warn); }

/* ---------- Чат ---------- */
.chat { display: flex; flex-direction: column; height: calc(100dvh - 60px - var(--bottom-nav) - 190px); min-height: 340px; }
.chat-log { flex: 1; overflow-y: auto; padding: 8px 2px 16px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 18px; word-wrap: break-word; overflow-wrap: anywhere; font-size: 14.5px; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 6px; }
.msg.assistant table { margin: 8px 0; background: var(--surface); font-size: 13px; }
.msg.assistant p { margin: 0 0 8px; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant ul, .msg.assistant ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.assistant code { background: rgba(0,0,0,.06); padding: 1px 4px; border-radius: 4px; }
.msg.assistant h3 { font-size: 15px; margin: 6px 0; }
.msg.error, .msg.error { align-self: center; background: #fee2e2; color: #991b1b; font-size: 13px; max-width: 100%; }
.tool-note { align-self: flex-start; font-size: 12px; color: var(--muted); font-style: italic; }
.chat-form { display: flex; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; align-items: flex-end; }
.chat-form textarea { min-height: 46px; height: 46px; max-height: 140px; border-radius: 14px; }
.chat-form .btn { flex: none; }
.suggestions { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.suggestions::-webkit-scrollbar { display: none; }
.suggestions button { flex: none; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text); white-space: nowrap; }
.suggestions button:hover { border-color: var(--brand); color: var(--brand); }
.typing::after { content: "▋"; animation: blink 1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Лендинг ---------- */
.hero { position: relative; background: radial-gradient(1200px 500px at 80% -10%, rgba(31,94,255,.55), transparent 60%),
  radial-gradient(800px 400px at -10% 110%, rgba(255,106,26,.35), transparent 60%), var(--navy); color: #fff; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 40px 40px; pointer-events: none; }
.hero-inner { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 28px var(--gutter) 32px; display: grid; gap: 24px; }
.hero h1 { font-size: 32px; margin-bottom: 14px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero-lead { font-size: 16px; color: rgba(255,255,255,.8); margin: 0 0 20px; }
.hero-points { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.hero-points li { display: flex; gap: 10px; align-items: center; font-weight: 600; color: rgba(255,255,255,.92); }
.hero-points .icon { color: var(--accent); width: 20px; height: 20px; }
.hero-cta { display: grid; gap: 10px; }
.calc-card { color: var(--text); border: none; box-shadow: var(--shadow-lg); }
.calc-card h2 { display: flex; align-items: center; gap: 10px; }
.calc-card h2 .icon { color: var(--brand); }

.section { max-width: 1200px; margin: 0 auto; padding: 40px var(--gutter); }
.section-head { margin-bottom: 22px; }
.section-head .eyebrow { color: var(--accent); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.section-head h2 { font-size: 26px; margin: 6px 0 8px; }
.section-head p { color: var(--muted); margin: 0; max-width: 640px; }

/* Рекламная карусель */
.promos { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px var(--gutter) 10px; margin: 0 calc(-1 * var(--gutter)); scrollbar-width: none; }
.promos::-webkit-scrollbar { display: none; }
.promo { position: relative; flex: 0 0 88%; scroll-snap-align: center; min-height: 200px; border-radius: 20px; padding: 22px; color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; box-shadow: var(--shadow); background-size: cover; background-position: center; }
.promo::before { content: ""; position: absolute; inset: 0; z-index: 0; }
.promo > * { position: relative; z-index: 1; }
.promo h3 { font-size: 20px; margin: 0; }
.promo p { margin: 0 0 10px; color: rgba(255,255,255,.88); font-size: 14px; }
.promo .btn { align-self: flex-start; }
.promo.t-blue { background-color: var(--brand); background-image: linear-gradient(135deg, #1f5eff, #0a2a8a); }
.promo.t-orange { background-color: var(--accent); background-image: linear-gradient(135deg, #ff6a1a, #c2410c); }
.promo.t-dark { background-color: var(--navy); background-image: linear-gradient(135deg, #13254f, #0a1633); }
.promo.has-img::before { background: linear-gradient(180deg, rgba(10,22,51,.05) 20%, rgba(10,22,51,.85) 100%); }
.promo .deco { position: absolute; right: -20px; top: -20px; width: 150px; height: 150px; opacity: .14; z-index: 0; }
.promo-dots { display: flex; justify-content: center; gap: 6px; margin-top: 4px; }
.promo-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: all .2s; }
.promo-dots span.on { width: 20px; border-radius: 4px; background: var(--brand); }
.promo.promo-inline { min-height: 0; padding: 20px; align-items: flex-start; margin-bottom: 16px; }
.calc-result { scroll-margin-top: 76px; }

/* Услуги, шаги, преимущества */
/* На телефоне — список «иконка слева», с планшета — карточки */
.services { display: grid; gap: 10px; grid-template-columns: 1fr; }
.service { display: grid; grid-template-columns: 44px 1fr; gap: 2px 14px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.service > :not(.ic) { grid-column: 2; }
.service:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.service .ic { grid-row: span 2; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.service:nth-child(even) .ic { background: var(--accent-soft); color: var(--accent); }
.service h3 { font-size: 15px; margin-bottom: 4px; }
.service p { margin: 0; font-size: 13px; color: var(--muted); }
.steps { display: grid; gap: 12px; counter-reset: step; }
.step { background: var(--surface); border-radius: var(--radius); padding: 18px 18px 18px 64px; position: relative; border: 1px solid var(--border); }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 16px; top: 16px; width: 34px; height: 34px; border-radius: 10px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; }
.step h3 { font-size: 16px; margin-bottom: 4px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
.why { background: var(--navy); color: #fff; }
.why .section-head p { color: rgba(255,255,255,.7); }
.why-grid { display: grid; gap: 12px; }
.why-item { display: flex; gap: 14px; padding: 16px; border-radius: var(--radius); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.why-item .icon { color: var(--accent); width: 26px; height: 26px; margin-top: 2px; }
.why-item h3 { font-size: 16px; margin-bottom: 4px; }
.why-item p { margin: 0; font-size: 14px; color: rgba(255,255,255,.72); }
.contacts { display: grid; gap: 12px; }
.contact { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.contact .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.contact .lbl { font-size: 12px; color: var(--muted); font-weight: 700; }
.contact .val { font-weight: 700; overflow-wrap: anywhere; }
.footer { background: var(--navy); color: rgba(255,255,255,.6); font-size: 13px; padding: 26px var(--gutter) calc(90px + env(safe-area-inset-bottom)); text-align: center; }
.footer .logo { justify-content: center; margin-bottom: 8px; }
.cta-band { border-radius: 22px; padding: 24px; background: linear-gradient(135deg, var(--accent), #ff9a4d); color: #fff; display: grid; gap: 14px; }
.cta-band h2 { margin: 0; }
.cta-band p { margin: 0; color: rgba(255,255,255,.9); }

/* Плавающая кнопка на телефоне */
.fab-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; transform: translateY(110%); transition: transform .25s; }
.fab-bar.show { transform: none; }

/* ---------- Кабинет клиента ---------- */
.welcome { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.welcome .avatar { width: 44px; height: 44px; }
.welcome h1 { font-size: 22px; margin: 0; }
.order-cards { display: grid; gap: 12px; }
.order-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s; }
.order-card:hover { border-color: var(--brand); }
.order-card .route { font-size: 17px; font-weight: 800; margin: 6px 0 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.order-card .route .icon { width: 18px; height: 18px; color: var(--muted); }
.progress { display: flex; gap: 4px; margin: 12px 0 8px; }
.progress span { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-2); }
.progress span.on { background: var(--brand); }
.progress.done span.on { background: var(--ok); }
.progress.cancel span { background: #fecaca; }
.order-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.order-card .price { font-weight: 800; color: var(--text); font-size: 16px; }
.calc-history .item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.calc-history .item:last-child { border-bottom: none; }

/* ---------- Гистограмма ---------- */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 46px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.margin { background: var(--accent); }
.bar-col .lbl { font-size: 11px; color: var(--muted); }
.bar-col .val { font-size: 11px; font-weight: 700; }
.hbar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; min-width: 80px; }
.hbar > div { height: 100%; background: var(--brand); }

.toast { position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(16px + var(--bottom-nav) + env(safe-area-inset-bottom)); background: var(--navy); color: #fff; padding: 13px 18px; border-radius: 14px; z-index: 100; box-shadow: var(--shadow-lg); font-weight: 600; text-align: center; }
.toast.err { background: var(--danger); }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr; gap: 2px 12px; }
.kv div:nth-child(odd) { color: var(--muted); font-size: 12.5px; font-weight: 700; margin-top: 8px; }

/* Переписка с менеджером */
.attach { font-size: 12.5px; background: rgba(0,0,0,.06); border-radius: 8px; padding: 5px 9px; margin: 4px 0; }
.msg.user .attach { background: rgba(255,255,255,.18); }
.count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; text-align: center; line-height: 18px; margin-left: 4px; }
.threads { display: grid; grid-template-columns: 1fr; gap: 16px; }
.thread-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.thread-item:hover { background: var(--surface-2); }
.thread-item.active { background: var(--brand-soft); border-color: var(--brand); }
.thread-item .preview { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; vertical-align: middle; object-fit: cover; }

/* Админка: редактор рекламы */
.promo-admin { display: grid; gap: 16px; }
.promo-admin .promo { flex: none; min-height: 170px; }

/* ================= Планшет и шире ================= */
@media (min-width: 640px) {
  :root { --gutter: 24px; }
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calc-grid { grid-template-columns: repeat(3, 1fr); }
  .calc-grid .wide-sm { grid-column: auto; }
  .route-swap { grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .overlay { align-items: flex-start; padding: 48px 16px; }
  .modal { border-radius: 20px; max-width: 520px; max-height: none; padding: 26px; }
  .modal.wide { max-width: 980px; }
  .quote-meta { grid-template-columns: repeat(4, 1fr); }
  .quote-actions { grid-template-columns: 1fr 1fr; }
  .promo { flex-basis: 70%; }
  .services { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .service { display: block; padding: 18px; }
  .service .ic { margin-bottom: 10px; }
  .contacts { grid-template-columns: repeat(2, 1fr); }
  .kv { grid-template-columns: 170px 1fr; gap: 8px 12px; }
  .kv div:nth-child(odd) { margin-top: 0; font-size: 13px; }
  .order-cards { grid-template-columns: repeat(2, 1fr); }
  .toast { left: auto; right: 24px; bottom: 24px; max-width: 420px; }
  .cta-band { grid-template-columns: 1fr auto; align-items: center; padding: 32px; }
  .hero-cta { grid-template-columns: auto auto; justify-content: start; }
  .msg { max-width: 78%; }
}

/* ================= Десктоп ================= */
@media (min-width: 960px) {
  h1 { font-size: 36px; }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .topbar { height: 66px; }
  .topbar .user { display: inline; }
  .nav-links { display: flex; }
  .hero-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 520px); align-items: center; padding: 64px var(--gutter) 72px; gap: 48px; }
  .hero h1 { font-size: 48px; }
  .hero-lead { font-size: 18px; }
  .section { padding: 64px var(--gutter); }
  .section-head h2 { font-size: 34px; }
  .promo { flex-basis: calc((100% - 28px) / 3); min-height: 240px; }
  .services { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .service { padding: 22px; }
  .steps { grid-template-columns: repeat(4, 1fr); }
  .why-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .contacts { grid-template-columns: repeat(3, 1fr); }
  .fab-bar { display: none; }
  .footer { padding-bottom: 26px; }
  .layout { display: grid; grid-template-columns: 230px 1fr; }
  .sidebar { display: block; position: sticky; top: 66px; height: calc(100vh - 66px); border-bottom: none; border-right: 1px solid var(--border); padding: 16px 10px; overflow-y: auto; }
  .sidebar button { display: block; width: 100%; margin-bottom: 2px; }
  .main { padding: 24px; }
  .threads { grid-template-columns: 300px 1fr; }
  .chat { height: calc(100vh - 66px - 170px); }
  .order-cards { grid-template-columns: repeat(3, 1fr); }
  .promo-admin { grid-template-columns: repeat(2, 1fr); }
  /* В кабинете на десктопе нижняя навигация превращается в обычные вкладки */
  .bottom-nav { position: static; display: flex; background: none; backdrop-filter: none; border-bottom: 1px solid var(--border); padding: 0; margin-bottom: 18px; }
  .bottom-nav .tab { flex-direction: row; font-size: 15px; padding: 12px 16px; border-radius: 0; border-bottom: 2px solid transparent; }
  .bottom-nav .tab.active { background: none; border-bottom-color: var(--brand); }
  .bottom-nav .count { position: static; }
  body.has-bottom-nav { --bottom-nav: 0px; padding-bottom: 0; }
}

/* ================= Вариант 1: «Инструмент на первом экране» ================= */
.hero-tool { background: var(--navy); overflow: visible; } /* панель выступает за нижний край — не обрезать */
.hero-tool::after { display: none; }
.hero-tool-inner { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 36px var(--gutter) 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero-tool h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.08; margin: 0 0 14px; max-width: 880px; }
.hero-tool h1 em { font-style: normal; color: var(--accent); }
.hero-tool .hero-lead { max-width: 660px; margin: 0 0 28px; color: #b8c2d9; }
/* Панель — отдельная карточка, выступает из тёмного блока вниз на светлый фон */
.tool-card { position: relative; z-index: 2; width: 100%; max-width: 1000px; background: var(--surface); color: var(--text); text-align: left; border-radius: 20px; border: 1px solid var(--border); box-shadow: 0 24px 60px rgba(10,22,51,.22); margin-bottom: -72px; scroll-margin-top: 84px; }
.tool-tabs { display: flex; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tool-tabs::-webkit-scrollbar { display: none; }
/* На телефоне — три равные вкладки, подпись может переноситься; с планшета — в одну строку */
.tool-tab { flex: 1 1 0; min-width: 0; min-height: 56px; padding: 6px 8px; border: none; border-bottom: 3px solid transparent; background: var(--surface-2); font: inherit; font-weight: 700; font-size: 14px; line-height: 1.2; color: var(--muted); cursor: pointer; }
.tool-tab:first-child { border-top-left-radius: 20px; }
.tool-tab:last-child { border-top-right-radius: 20px; }
.tool-tab.active { background: var(--surface); color: var(--text); font-weight: 800; border-bottom-color: var(--accent); }
.tool-tab:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: -3px; }
.tool-panel { padding: 20px var(--gutter) 24px; }
.track-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.track-form .field span { display: block; margin-bottom: 6px; }
.track-form .btn { min-height: 46px; }
.order-steps { display: grid; gap: 10px; font-size: 15px; }
.order-steps strong { color: var(--accent-dark); }
/* Шаги под героем */
.steps3 { display: grid; gap: 14px; padding-top: 104px; }
.step3 { border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; background: var(--surface); }
.step3 .eyebrow { font-size: 13px; font-weight: 800; color: #c2410c; text-transform: uppercase; letter-spacing: .06em; }
.step3 h3 { font-size: 20px; margin: 6px 0; }
.step3 p { margin: 0; color: var(--muted); font-size: 15px; }

@media (min-width: 640px) {
  .tool-panel { padding: 24px; }
  .tool-card { margin-bottom: -96px; }
  .steps3 { padding-top: 136px; }
  .tool-tab { padding: 0 18px; font-size: 15px; white-space: nowrap; }
  .steps3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 960px) {
  .hero-tool-inner { padding-top: 64px; }
  .hero-tool .hero-lead { font-size: 18px; }
  /* Калькулятор в панели: Откуда · Куда · Транспорт / Вес · Объём · Стоимость · Кнопка */
  .tool-card .calc-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 12px; align-items: end; }
  .tool-card .route-swap, .tool-card .calc-grid { display: contents; }
  .tool-card .calc-form > .field:not(details) { grid-column: 3 / 5; }
  .tool-card .calc-grid > .field { grid-row: 2; }
  .tool-card .calc-form > button[type=submit] { grid-row: 2; grid-column: 4; margin-bottom: 14px; min-height: 46px; }
  .tool-card .calc-form > details { grid-column: 1 / -1; grid-row: 3; }
  .tool-card .calc-form > .chips { grid-column: 1 / -1; grid-row: 4; margin-bottom: 0 !important; }
}

/* ================= DLZ Менеджер (мобильное приложение) ================= */
.mgr .bottom-nav { grid-template-columns: repeat(3, 1fr); }
.mgr .topbar #back { min-height: 40px; padding: 6px 10px; }
.mgr-main { padding-top: 14px; }
.mgr-list { display: grid; gap: 8px; }
.mgr-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; font: inherit; color: var(--text); cursor: pointer; min-height: 64px; }
.mgr-item:hover, .mgr-item:focus-visible { border-color: var(--brand); outline: none; }
.mgr-ava { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; font-size: 17px; }
.mgr-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mgr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgr-preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mgr-client { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; }
.mgr-chat { height: calc(100dvh - 60px - var(--bottom-nav) - 130px); min-height: 320px; }
.mgr .order-card .route { font-size: 16px; }
@media (min-width: 960px) { .mgr-chat { height: calc(100vh - 66px - 220px); } }
