/* =========================================================
   Логістика імпорту — світла «операційна» тема
   Бірюзовий акцент (#008c91) з робочої шпаргалки, темно-синій текст.
   ========================================================= */

:root {
  color-scheme: light;
  --bg: #edf1f4;
  --card: #fff;
  --ink: #182d43;
  --muted: #536477;
  --line: #dde5eb;
  --teal: #008c91;
  --teal-d: #007e84;
  --teal-soft: #eaf6f5;
  --amber: #d99a26;
  --amber-soft: #fff4df;
  --red: #c0392b;
  --red-soft: #fdecea;
  --green: #1f9d57;
  --r: 14px;
  --shadow: 0 1px 2px rgba(24, 45, 67, .06), 0 8px 24px rgba(24, 45, 67, .06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Onest, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--teal-d); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.muted { color: var(--muted); }

.gate { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

/* ----- Шапка ----- */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1040px; margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; gap: 16px; }
.back-hub { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px 6px 6px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.back-hub:hover { background: var(--bg); color: var(--ink); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--teal); color: #fff; display: grid; place-items: center; }
.brand strong { font-size: 17px; letter-spacing: -.01em; }
.nav { display: flex; gap: 4px; margin-left: 10px; }
.nav a { padding: 7px 13px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--teal-soft); color: var(--teal-d); }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.icon { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.icon:hover { background: var(--red-soft); color: var(--red); }

.banner { background: var(--teal-soft); color: var(--teal-d); text-align: center; padding: 8px 18px; font-size: 13.5px; }
.banner.warn { background: var(--amber-soft); color: #8a5a00; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 24px 18px 80px; }

/* ----- Кнопки ----- */
.btn { height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: #c4d0da; background: #f7fafb; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-d); border-color: var(--teal-d); }
.btn.danger { color: var(--red); border-color: #efc3bd; }
.btn.danger:hover { background: var(--red-soft); }

/* ----- Список ----- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.page-head h1 { font-size: 28px; letter-spacing: -.02em; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 28px; line-height: 1.1; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.amber { border-color: #f0d49a; background: var(--amber-soft); }
.stat.red { border-color: #efc3bd; background: var(--red-soft); }
.stat.red b { color: var(--red); }

.tools { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.chip span { font-size: 12px; background: var(--bg); border-radius: 999px; padding: 1px 7px; }
.chip:hover { border-color: #c4d0da; }
.chip.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip.on span { background: rgba(255, 255, 255, .22); }
#q { height: 38px; min-width: 260px; flex: 1; max-width: 360px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

.trips { display: flex; flex-direction: column; gap: 10px; }
.trip { display: grid; grid-template-columns: minmax(0, 1.6fr) auto minmax(150px, .8fr); gap: 18px; align-items: center; padding: 15px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.trip:hover { border-color: var(--teal); box-shadow: var(--shadow); transform: translateY(-1px); }
.trip-id { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--teal-d); }
.trip-title { font-weight: 700; font-size: 16.5px; letter-spacing: -.01em; }
.trip-sub { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-mid { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.prog { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.trip-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.late { color: var(--red); font-weight: 700; }

.st { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.st-prep { background: #e8edf2; color: #3d5166; }
.st-road { background: #e1effb; color: #1c5f9c; }
.st-border { background: var(--amber-soft); color: #8a5a00; }
.st-deliv { background: var(--teal-soft); color: var(--teal-d); }
.st-closed { background: #e3f4ea; color: #17714a; }
.pay { font-size: 12.5px; font-weight: 600; padding-left: 14px; position: relative; color: var(--muted); }
.pay::before { content: ""; position: absolute; left: 2px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--red); }
.pay-partial::before { background: var(--amber); }
.pay-paid::before { background: var(--green); }

.empty { background: var(--card); border: 1px dashed #c4d0da; border-radius: var(--r); padding: 38px 20px; text-align: center; }
.empty b { font-size: 17px; }
.empty p { margin-top: 6px; }

/* ----- Картка рейсу ----- */
.crumb { display: inline-block; margin-bottom: 14px; text-decoration: none; font-weight: 600; color: var(--muted); }
.crumb:hover { color: var(--ink); }
.trip-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 16px; }
.trip-head h1 { font-size: 28px; letter-spacing: -.02em; margin: 2px 0 4px; }
.ring { --p: 0; width: 76px; height: 76px; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 7px; background: var(--bg); border-radius: 50%; }
.ring b, .ring small { position: relative; grid-area: 1 / 1; }
.ring b { font-size: 17px; margin-top: -8px; }
.ring small { font-size: 10.5px; color: var(--muted); margin-top: 20px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 14px; }
.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--teal-d); margin-bottom: 12px; }

.stepper { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.ss { flex: none; display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px 0 6px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-weight: 600; font-size: 13px; }
.ss i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; font-size: 12px; }
.ss:hover { border-color: var(--teal); }
.ss.past { background: var(--teal-soft); border-color: #bfe3e0; color: var(--teal-d); }
.ss.past i { background: var(--teal); color: #fff; }
.ss.now { background: var(--teal); border-color: var(--teal); color: #fff; }
.ss.now i { background: #fff; color: var(--teal-d); }

.pay-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.lbl { font-weight: 700; font-size: 13px; color: var(--muted); }
.segs { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg { border: 0; background: #fff; padding: 8px 16px; font-weight: 600; font-size: 13.5px; color: var(--muted); border-right: 1px solid var(--line); }
.seg:last-child { border-right: 0; }
.seg:hover { background: #f7fafb; }
.seg.on.pay-unpaid { background: var(--red-soft); color: var(--red); }
.seg.on.pay-partial { background: var(--amber-soft); color: #8a5a00; }
.seg.on.pay-paid { background: #e3f4ea; color: #17714a; }
.seg::before { display: none; }

.cps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.cp { display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.cp b { display: block; font-size: 14px; }
.cp small { color: var(--muted); font-size: 12.5px; line-height: 1.35; display: block; margin-top: 2px; }
.cp-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: var(--bg); color: var(--muted); }
.cp.ok { background: var(--teal-soft); border-color: #bfe3e0; }
.cp.ok .cp-dot { background: var(--teal); color: #fff; }

.tabs { display: flex; gap: 4px; margin-bottom: 10px; overflow-x: auto; }
.tabbtn { border: 0; background: transparent; padding: 9px 15px; border-radius: 10px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tabbtn:hover { background: #fff; }
.tabbtn.on { background: #fff; color: var(--teal-d); box-shadow: inset 0 -2px 0 var(--teal); border-radius: 10px 10px 0 0; }

/* ----- Чекліст ----- */
.step { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.step:last-child { margin-bottom: 0; }
.step.full { border-color: #bfe3e0; }
.step-h { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px; background: #fff; border: 0; text-align: left; }
.step-h:hover { background: #f7fafb; }
.step.open .step-h { background: var(--teal-soft); }
.step-n { flex: none; width: 30px; height: 30px; border-radius: 9px; background: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--muted); }
.step.full .step-n { background: var(--teal); color: #fff; }
.step-t { flex: 1; min-width: 0; }
.step-t b { display: block; font-size: 15px; }
.step-t small { color: var(--muted); font-size: 12.5px; }
.step-c { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.chev { color: var(--muted); transition: transform .2s; }
.step.open .chev { transform: rotate(180deg); }
.step-b { padding: 6px 14px 14px; border-top: 1px solid var(--line); }
.chk { flex-direction: row; font-size: 14.5px; font-weight: 500; color: var(--ink); display: flex; gap: 11px; align-items: flex-start; padding: 8px 4px; cursor: pointer; border-radius: 8px; }
.chk:hover { background: #f7fafb; }
.chk input { flex: none; width: 19px; height: 19px; margin: 2px 0 0; accent-color: var(--teal); cursor: pointer; }
.chk input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: #b9c6d1; }
.note { background: var(--teal-soft); border-left: 4px solid var(--teal); padding: 10px 13px; border-radius: 4px 10px 10px 4px; margin-top: 10px; font-size: 14px; }
.note.warn { background: var(--amber-soft); border-left-color: var(--amber); }
.note ol { margin: 6px 0 0; padding-left: 20px; }

/* ----- Форми ----- */
.sub { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--teal-d); margin: 20px 0 10px; }
.sub:first-child { margin-top: 0; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.fgrid .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=date], input:not([type]), input[inputmode], select, textarea { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-weight: 500; color: var(--ink); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0, 140, 145, .35); border-color: var(--teal); }
.req { color: var(--red); }
.danger-zone { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }

.cost-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.cur { width: 110px; flex: none; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 18px; padding: 14px 16px; background: var(--teal-soft); border-radius: 12px; }
.total b { font-size: 24px; letter-spacing: -.01em; }

.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log li:last-child { border: 0; }
.log time { color: var(--muted); font-size: 13px; }
.log em { color: var(--muted); font-style: normal; font-size: 13px; }

/* ----- Шпаргалка ----- */
.cp-list { margin: 0; padding-left: 20px; }
.cp-list li { margin: 5px 0; }
.guide-step .sec { display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; font-size: 17px; color: var(--ink); }
.gn { background: var(--teal); color: #fff; border-radius: 8px; padding: 2px 8px; font-size: 13px; letter-spacing: .04em; }
.owner { color: var(--teal-d); font-weight: 600; font-size: 13.5px; margin: -4px 0 8px; }
.gl { margin: 0; padding-left: 20px; }
.gl li { margin: 5px 0; }
.path { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.path i { font-style: normal; color: var(--muted); }
.fine { color: var(--muted); font-size: 12.5px; margin-top: 12px; }

/* ----- Діалоги, повідомлення ----- */
.dlg { border: 0; border-radius: 18px; padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(24, 45, 67, .35); color: var(--ink); }
.dlg::backdrop { background: rgba(24, 45, 67, .45); }
.dlg h2 { font-size: 20px; margin-bottom: 14px; }
.dlg form { display: flex; flex-direction: column; gap: 12px; }
.dlg.small { width: min(380px, calc(100vw - 32px)); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; z-index: 50; box-shadow: var(--shadow); }

/* ----- Телефон ----- */
@media (max-width: 760px) {
  .top-in { flex-wrap: wrap; gap: 8px 10px; padding: 8px 14px; }
  .brand strong { font-size: 15px; }
  .nav { order: 4; width: 100%; margin: 0; }
  .nav a { flex: 1; text-align: center; background: var(--bg); }
  .nav a.on { background: var(--teal-soft); }
  #who-name { display: none; }
  .wrap { padding: 18px 14px 70px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .trip { grid-template-columns: 1fr; gap: 10px; }
  .trip-mid { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
  #q { max-width: none; min-width: 0; width: 100%; flex-basis: 100%; }
  .cps { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: stretch; }
  .trip-head h1, .page-head h1 { font-size: 23px; }
  .panel { padding: 15px 14px; }
  .log li { grid-template-columns: 1fr; gap: 2px; }
  .cost-head { flex-direction: column; align-items: stretch; }
  .cur { width: 100%; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media print {
  body { background: #fff; }
  .top, .banner, .page-head .btn, .toast, .crumb { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .panel { box-shadow: none; break-inside: avoid; }
}
