/* =========================================================
   Візуальний шар «Пульт + Мозаїка»
   Темна нічна карта й шапка (як диспетчерський пульт), світлі плитки
   різних кольорів для цифр. Цифри — Exo 2, текст — Onest.
   ========================================================= */

:root {
  --bg: #eceef4;
  --ink: #15171f;
  --muted: #5f667a;
  --line: #e1e4ec;
  --night: #0d1424;
  --night-2: #141d33;
  --night-line: rgba(255, 255, 255, .1);
  --night-muted: #8d9bb5;
  --deep: #0f3d3e;
  --lime: #d8f26a;
  --coral: #ff6b57;
  --lav: #e4dcff;
  --cy: #39c6ff;
  --am: #ffb43a;
  --teal: #0f7f84;
  --teal-d: #0b6b70;
  --teal-soft: #e3f3f2;
  --r: 22px;
  --num: "Exo 2", Onest, system-ui, sans-serif;
}
body { font-size: 14.5px; }
.wrap { max-width: 1280px; }

/* ----- Шапка в кольорі пульта ----- */
.top { background: var(--night); border-bottom: 0; }
.top-in { max-width: 1280px; }
.back-hub, .who { color: var(--night-muted); }
.back-hub:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.brand strong { color: #fff; font-family: var(--num); font-weight: 700; font-size: 18px; }
.brand-mark { background: var(--lime); color: var(--night); }
.nav a { color: var(--night-muted); }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.on { background: rgba(255, 255, 255, .14); color: #fff; }
.avatar { background: var(--lime); color: var(--night); }
.icon { color: var(--night-muted); }
.icon:hover { background: rgba(255, 107, 87, .18); color: var(--coral); }

/* ----- Загальні елементи стають м'якшими ----- */
.panel, .stat, .rowcard, .trip, .cp, .empty { border-radius: var(--r); border-color: transparent; }
.panel { box-shadow: 0 1px 2px rgba(21, 23, 31, .04); }
.page-head h1, .trip-head h1 { font-family: var(--num); font-weight: 800; letter-spacing: -.01em; }
.stat b { font-family: var(--num); }
.btn { border-radius: 12px; }
.btn.primary { background: var(--ink); border-color: var(--ink); }
.btn.primary:hover { background: #2a2e3d; border-color: #2a2e3d; }
.chip { border-color: transparent; box-shadow: 0 1px 2px rgba(21, 23, 31, .06); }
.chip.on { background: var(--ink); border-color: var(--ink); }
#q { border-radius: 999px; border-color: transparent; box-shadow: 0 1px 2px rgba(21, 23, 31, .06); padding: 0 18px; }
.sec { text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.sub { text-transform: none; letter-spacing: 0; font-size: 14.5px; font-weight: 700; color: var(--ink); }
.head-btns .btn { height: 42px; }

/* ----- Карти ----- */
.mapbox { position: absolute; inset: 0; background: var(--night); }
.lmap { position: absolute; inset: 0; background: var(--night); }
.leaflet-container { font: inherit; }
.leaflet-control-zoom a { background: var(--night-2) !important; color: #fff !important; border-color: #2a3858 !important; }
.leaflet-control-attribution { background: rgba(13, 20, 36, .7) !important; color: var(--night-muted) !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: var(--night-muted) !important; }
.trk { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--c); border: 3px solid var(--night); box-shadow: 0 0 0 2px var(--c), 0 4px 14px rgba(0, 0, 0, .5); text-decoration: none; }
.trk.big { width: 36px; height: 36px; margin: -3px; box-shadow: 0 0 0 3px var(--c), 0 0 22px var(--c); }
.trk.idle { width: 14px; height: 14px; margin: 8px; border-width: 2px; }
.ttip { background: var(--night-2); color: #fff; border: 1px solid var(--night-line); border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); font-size: 12.5px; }
.ttip::before { display: none; }
.ttip.home { background: var(--teal); border-color: var(--teal); font-weight: 700; }
.leaflet-interactive.flow { stroke-dasharray: 10 12; animation: flow 1.1s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -22; } }
.map-note { position: absolute; left: 14px; bottom: 14px; z-index: 500; margin: 0; max-width: 360px; background: rgba(13, 20, 36, .88); color: #dfe6f3; border: 1px solid var(--night-line); border-radius: 12px; padding: 8px 12px; font-size: 12.5px; }

/* ----- Сьогодні ----- */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; }
.hello h1 { font-family: var(--num); font-weight: 800; font-size: 30px; letter-spacing: -.01em; }
.hello p::first-letter { text-transform: uppercase; }
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 150px; gap: 14px; }
.t { background: #fff; border-radius: var(--r); padding: 18px 20px; position: relative; overflow: hidden; color: inherit; text-decoration: none; }
.t h2 { font-size: 14px; font-weight: 700; color: var(--muted); margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
a.t { transition: transform .15s; }
a.t:hover { transform: translateY(-2px); }
.t-map { grid-column: span 2; grid-row: span 3; padding: 0; background: var(--night); }
.map-lb { position: absolute; left: 16px; top: 16px; z-index: 500; background: rgba(13, 20, 36, .88); color: #fff; border: 1px solid var(--night-line); border-radius: 14px; padding: 8px 14px; font-weight: 600; pointer-events: none; }
.map-lb b { font-family: var(--num); font-size: 20px; color: var(--lime); margin-right: 3px; }
.map-go { position: absolute; right: 14px; top: 14px; z-index: 500; background: var(--lime); color: var(--night); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13px; text-decoration: none; }
.k { display: flex; flex-direction: column; }
.k b { display: block; font-family: var(--num); font-size: 60px; font-weight: 800; letter-spacing: -.03em; line-height: .95; margin-top: 4px; }
.k small { flex: none; margin-top: auto; font-weight: 600; font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.k-deep { background: var(--deep); color: #fff; } .k-deep h2 { color: #9fd0c8; }
.k-lime { background: var(--lime); } .k-lime h2 { color: #55631b; }
.k-coral { background: var(--coral); color: var(--ink); } .k-coral h2 { color: #3d0c05; }
.k-calm { background: #dff5ea; } .k-calm h2 { color: #2c7a55; }
.k-lav { background: var(--lav); } .k-lav h2 { color: #574693; }
.top { z-index: 1000; }
.t-al { grid-column: span 2; grid-row: span 4; display: flex; flex-direction: column; }
.al { list-style: none; margin: 0; padding: 0 2px 0 0; display: flex; flex-direction: column; gap: 7px; overflow: auto; flex: 1; scrollbar-width: thin; }
.al-i { display: flex; gap: 11px; align-items: center; background: #f4f5f9; border-radius: 14px; padding: 9px 12px; text-decoration: none; color: var(--ink); }
.al-i:hover { background: #eceef5; }
.al-i i { flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-style: normal; font-weight: 800; color: var(--ink); background: #7ba6f5; }
.al-i.red i { background: var(--coral); } .al-i.amber i { background: var(--am); }
.al-i b { display: block; font-size: 13.5px; font-weight: 600; }
.al-i small { display: block; color: var(--muted); font-size: 12.5px; }
.calm { margin: auto 0; } .calm b { font-family: var(--num); font-size: 22px; }
.t-don { grid-column: span 2; display: flex; align-items: center; gap: 20px; }
.dn svg { width: 116px; height: 116px; display: block; }
.dn-n { font: 800 26px var(--num); fill: var(--ink); } .dn-l { font: 600 11px Onest, sans-serif; fill: var(--muted); }
.lg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.lg a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.lg a:hover { text-decoration: underline; }
.lg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; }
.lg b { margin-left: 6px; color: var(--muted); }
.t-car { grid-column: span 2; grid-row: span 2; }
.cr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 13.5px; }
.cr:last-child { border: 0; }
.cr:hover .cr-n { text-decoration: underline; }
.cr-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-b { height: 12px; background: #eef0f5; border-radius: 99px; overflow: hidden; }
.cr-b i { display: block; height: 100%; background: var(--deep); border-radius: 99px; }
.cr:first-of-type .cr-b i { background: var(--coral); }
.cr-v { text-align: right; } .cr-v b { font-family: var(--num); font-size: 16px; }
.cr-v small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.t-cal { grid-column: span 4; grid-row: span 1; display: flex; flex-direction: column; }
.cal-h { display: flex; justify-content: space-between; align-items: center; }
.cal-late { color: #c63b28; font-weight: 700; font-size: 13px; text-decoration: none; }
.days { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; flex: 1; min-height: 0; }
.d { border-radius: 12px; background: #f4f5f9; padding: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); min-width: 0; overflow: hidden; }
.d.we { background: #eceef4; }
.d.today { background: var(--night); color: var(--night-muted); }
.d.today b { color: #fff; }
.d-h b { font-family: var(--num); font-size: 15px; color: var(--ink); margin-right: 3px; }
.d-t { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; }
.d-t a { display: block; background: var(--c); color: var(--night); border-radius: 6px; padding: 1px 5px; font-size: 10.5px; font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----- Рейси: пульт ----- */
.pult { position: relative; height: 430px; border-radius: 26px; overflow: hidden; background: var(--night); margin-bottom: 20px; box-shadow: 0 14px 36px rgba(13, 20, 36, .22); }
.pult-top { position: absolute; left: 0; right: 0; top: 0; z-index: 500; display: flex; gap: 28px; padding: 18px 22px 40px; background: linear-gradient(rgba(13, 20, 36, .92), rgba(13, 20, 36, 0)); pointer-events: none; }
.pk { display: flex; align-items: baseline; gap: 8px; color: #fff; }
.pk b { font: 800 40px/1 var(--num); color: var(--cy); }
.pk span { color: var(--night-muted); font-size: 13px; max-width: 90px; line-height: 1.2; }
.pk.amber b { color: var(--am); } .pk.red b { color: var(--coral); } .pk.lav b { color: #c3b4ff; }
.pult-leg { position: absolute; right: 14px; bottom: 14px; z-index: 500; display: flex; gap: 12px; flex-wrap: wrap; background: rgba(13, 20, 36, .85); border: 1px solid var(--night-line); color: #dfe6f3; border-radius: 12px; padding: 7px 12px; font-size: 12px; font-weight: 600; margin-right: 46px; }
.pult-leg i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.list-head { align-items: flex-end; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.tile { background: #fff; border-radius: var(--r); padding: 15px 18px 14px; text-decoration: none; color: inherit; border: 2px solid transparent; box-shadow: 0 1px 2px rgba(21, 23, 31, .05); transition: border-color .15s, transform .15s, box-shadow .15s; display: flex; flex-direction: column; gap: 4px; position: relative; }
.tile::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c); }
.tile:hover { border-color: var(--c); transform: translateY(-2px); box-shadow: 0 12px 26px rgba(21, 23, 31, .1); }
.tile.is-late { background: #fff6f4; }
.tl-1 { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tl-id { font-family: var(--num); font-weight: 700; color: var(--ink); letter-spacing: .02em; }
.tl-kind { background: color-mix(in srgb, var(--k) 22%, #fff); color: #2d3340; border-radius: 99px; padding: 1px 9px; }
.tl-eta { margin-left: auto; white-space: nowrap; }
.is-late .tl-eta { color: #c63b28; font-weight: 700; }
.tile h3 { margin: 2px 0 0; font-family: var(--num); font-size: 19px; font-weight: 700; line-height: 1.2; }
.tl-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-rt { display: flex; align-items: center; gap: 10px; margin: 12px 0 8px; font-weight: 700; font-size: 13px; }
.tl-rt > span:not(.ln) { max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ln { flex: 1; position: relative; height: 4px; border-radius: 9px; background: repeating-linear-gradient(90deg, #d5dae4 0 6px, transparent 6px 11px); }
.ln i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c); border-radius: 9px; }
.ln u { position: absolute; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: var(--c); display: grid; place-items: center; border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.tl-ft { display: flex; align-items: center; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12.5px; }
.tl-st { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.tl-st i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tl-p { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 700; }
.tl-p b { --p: 0; width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(var(--ink) calc(var(--p) * 1%), #e3e6ee 0); }

/* ----- Картка рейсу ----- */
.trip-hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); background: var(--night); border-radius: 26px; overflow: hidden; margin-bottom: 18px; color: #e8eef9; box-shadow: 0 14px 36px rgba(13, 20, 36, .2); min-height: 340px; }
.th-map { position: relative; min-height: 300px; }
.th-empty { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 8px; padding: 28px; background: radial-gradient(circle at 30% 30%, #1b2744, var(--night)); }
.th-empty b { font-family: var(--num); font-size: 22px; color: #fff; }
.th-empty p { color: var(--night-muted); max-width: 360px; }
.th-empty .btn { background: var(--lime); border-color: var(--lime); color: var(--night); margin-top: 6px; }
.th-side { padding: 22px 22px 20px; border-left: 1px solid var(--night-line); }
.th-gauge { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.th-ring { --p: 0; width: 96px; height: 96px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255, 255, 255, .1) 0); display: grid; place-items: center; position: relative; flex: none; }
.th-ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--night); }
.th-ring b, .th-ring small { position: relative; grid-area: 1 / 1; }
.th-ring b { font: 800 24px var(--num); margin-top: -10px; color: #fff; }
.th-ring small { font-size: 10.5px; color: var(--night-muted); margin-top: 26px; }
.th-when small { display: block; color: var(--night-muted); font-size: 12px; }
.th-when b { font: 800 30px/1.1 var(--num); color: #fff; }
.th-when.late b { color: var(--coral); }
.th-steps { display: flex; gap: 3px; margin-bottom: 6px; }
.th-steps i { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); }
.th-steps i.on { background: var(--c); opacity: .65; }
.th-steps i.now { background: var(--c); box-shadow: 0 0 10px var(--c); }
.th-cur { font-weight: 600; margin-bottom: 16px; }
.th-cur small { color: var(--night-muted); font-weight: 400; }
.th-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.th-kv div { border: 1px solid var(--night-line); border-radius: 12px; padding: 8px 11px; min-width: 0; }
.th-kv dt { color: var(--night-muted); font-size: 11.5px; }
.th-kv dd { margin: 0; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-head .head-side { display: none; }
.ss.now { background: var(--ink); border-color: var(--ink); }
.ss.now i { color: var(--ink); }

/* ----- Планшет і телефон ----- */
@media (max-width: 1000px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t-map { grid-column: span 2; grid-row: span 3; }
  .t-al, .t-don, .t-car, .t-cal { grid-column: span 2; }
  .t-cal { grid-row: span 2; }
  .days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .trip-hero { grid-template-columns: 1fr; }
  .th-side { border-left: 0; border-top: 1px solid var(--night-line); }
}
@media (max-width: 760px) {
  .top-in { background: var(--night); }
  .nav a { background: rgba(255, 255, 255, .06); }
  .nav a.on { background: rgba(255, 255, 255, .16); }
  .hello { flex-direction: column; align-items: stretch; }
  .hello h1 { font-size: 24px; }
  .bento { grid-auto-rows: 150px; gap: 10px; }
  .t-map { grid-row: span 2; }
  .k b { font-size: 40px; }
  .t { padding: 14px 15px; }
  .k small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .t-don { grid-row: span 2; flex-direction: column; align-items: flex-start; gap: 10px; }
  .t-al { grid-row: span 3; }
  .t-car { grid-row: span 2; }
  .pult { height: 360px; border-radius: 20px; }
  .pult-top { gap: 14px; padding: 14px; flex-wrap: wrap; }
  .pk b { font-size: 28px; } .pk span { font-size: 11.5px; }
  .pult-leg { display: none; }
  .tiles { grid-template-columns: 1fr; }
  .trip-hero { border-radius: 20px; }
  .th-map { min-height: 260px; }
}
@media (prefers-reduced-motion: reduce) { .leaflet-interactive.flow { animation: none; } a.t, .tile { transition: none; } }
@media print { .pult, .trip-hero .th-map, .t-map { display: none !important; } }

/* Вантажі / Неоплачені */
.tile.cg { border-left: 5px solid var(--k, #6fd3b0); }
.cg-kv { margin: 6px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.cg-kv div { min-width: 0; }
.cg-kv dt { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.cg-kv dd { margin: 1px 0 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cg-no { color: var(--muted); font-weight: 400; }
.cg-imp { margin-top: 8px; padding: 8px 11px; border-radius: 12px; background: #fff4d9; font-size: 13px; line-height: 1.35; }
.cg-imp b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #8a5a00; margin-bottom: 2px; }
.cg-total { margin: 0 0 14px; padding: 12px 16px; border-radius: 16px; background: var(--lav); font-size: 15px; }
.cg-total b { font-family: var(--num); font-size: 22px; }
.cg-sum { margin-left: auto; font-family: var(--num); font-weight: 700; }
@media (max-width: 520px) { .cg-kv { grid-template-columns: 1fr; } }
.cg h4 { margin: 12px 0 2px; font-size: 12px; color: var(--teal-d); text-transform: uppercase; letter-spacing: .05em; }
.cg-notes { margin: 0; font-size: 13px; white-space: pre-wrap; }
.cg-kv dd { white-space: normal; overflow-wrap: anywhere; }
.tiles:has(.cg) { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); align-items: start; }
@media (max-width: 520px) { .tiles:has(.cg) { grid-template-columns: 1fr; } }

/* ----- Дрібні виправлення ----- */
.stars { color: #b87d00; }
.tools input[type=search] { height: 40px; flex: 1; min-width: 0; max-width: 380px; padding: 0 18px; border: 1px solid transparent; border-radius: 999px; background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(21, 23, 31, .06); }
@media (min-width: 761px) { .stepper { flex-wrap: wrap; } }

/* Шапка: на ноутбуці й планшеті розділи переходять у другий рядок, щоб сторінка не їхала вбік */
@media (max-width: 1100px) {
  .top-in { flex-wrap: wrap; gap: 8px 10px; }
  .nav { order: 4; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .nav a { flex: none; background: rgba(255, 255, 255, .06); }
  .nav a.on { background: rgba(255, 255, 255, .16); }
}
@media (max-width: 760px) {
  .back-hub span { display: none; }
  .back-hub { padding: 8px; }
  .brand { min-width: 0; flex: 1; }
  .brand strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-mark { flex: none; }
  .tools input[type=search] { max-width: none; flex-basis: 100%; }
}
@media (max-width: 520px) {
  .days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) and (pointer: coarse) {
  input, select, textarea { font-size: 16px !important; }
  .nav a, .chip, .map-go, .ms-lang .chip, .tact .btn, .qtable .acts .btn { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .icon, .back-hub { min-width: 40px; min-height: 40px; justify-content: center; }
  .crumb { padding: 10px 0; margin-bottom: 6px; }
  .back-hub, .icon { display: inline-grid; place-items: center; }
  .linkbtn, .qtable .linkbtn { min-width: 40px; min-height: 40px; }
  .lg a, .cal-late { padding: 10px 0; }
  .d-t a { padding: 7px 5px; }
  .contact a, .cchip a, .rowcard a { display: inline-block; padding: 10px 0; margin: -4px 0; }
}
