/* TMS page: hero job window, forwarder workflow, Portiom AI conversations,
   quotation profit board and the intermodal journey map.
   Leg and record tones are shared so one leg keeps one colour across sections. */

.tone-pickup,
.tone-inquiry { --t: #e08a1e; --t-text: #9a5b00; --t-soft: #fdf0dc; --t-bg: #fffaf2; }
.tone-ocean,
.tone-quote { --t: #1768ed; --t-text: #1658c0; --t-soft: #e4edfd; --t-bg: #f6f9ff; }
.tone-delivery,
.tone-job { --t: #0c9a6a; --t-text: #08785d; --t-soft: #dcf3e8; --t-bg: #f3fbf7; }

.jm-status {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
}

.jm-status.is-arrived { background: #e3f7ec; color: #067a4f; }
.jm-status.is-departed { background: #fff3df; color: #9a5b00; }
.jm-status.is-scheduled { background: #eaf2ff; color: #1658c0; }

/* ── Forwarder workflow ────────────────────────────────────────────────── */

.tms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px 40px;
  margin-bottom: 40px;
}

.tms-head > .section-head,
.tms-head > .tai-heading {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.tms-head .btn { flex: none; white-space: nowrap; }

.ff-board {
  padding: 28px;
  border: 1px solid #dce5ee;
  border-radius: 14px;
  background: #f6f9fc;
}

.ff-track {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr) 96px minmax(0, 1fr);
  align-items: stretch;
}

.ff-record {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 236px;
  padding: 14px;
  border: 1px solid #dfe6ee;
  border-radius: 12px;
  background: #fff;
  color: #14283f;
  transition: border-color 0.3s, box-shadow 0.3s, opacity 0.3s;
}

.ff-record.is-waiting { opacity: 0.5; }
.ff-record.is-active { border-color: var(--t); box-shadow: 0 0 0 3px var(--t-soft); }

.ff-record header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; padding: 0 4px; }

.ff-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--t-soft);
  color: var(--t-text);
}

.ff-icon .icon { width: 16px; height: 16px; }
.ff-kind { min-width: 0; }
.ff-kind small { display: block; color: #7b8798; font-size: 11px; font-weight: 600; }
.ff-kind b { display: block; overflow: hidden; font-size: 14px; white-space: nowrap; text-overflow: ellipsis; }

.ff-status {
  flex: none;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  animation: ff-pop 0.35s ease;
}

.ff-status.is-blue { background: #eaf2ff; color: #1658c0; }
.ff-status.is-green { background: #e3f7ec; color: #067a4f; }
.ff-status.is-amber { background: #fff3df; color: #9a5b00; }
.ff-status.is-grey { background: #eff2f5; color: #5f6f86; }

.ff-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.ff-party {
  overflow: hidden;
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f7f9fb;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ff-path {
  display: grid;
  grid-template-columns: auto minmax(24px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #edf0f4;
  border-radius: 10px;
  background: #fafbfc;
  font-size: 13px;
  font-weight: 600;
}

.ff-path i {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #c9d4e0 0 6px, transparent 6px 10px);
}

.ff-cargo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 10px 12px;
  border: 1px solid #edf0f4;
  border-radius: 10px;
}

.ff-pallets {
  display: grid;
  flex: none;
  grid-template-columns: repeat(5, 10px);
  gap: 3px;
  padding: 7px 8px;
  border: 1px dashed #e0c89a;
  border-radius: 6px;
  background: #fff;
}

.ff-pallets i {
  display: block;
  width: 10px;
  height: 11px;
  border: 1px solid #ead9b8;
  border-radius: 2px;
  background: var(--t-soft);
  box-shadow: inset 0 3px 0 #ead9b8;
}

.ff-cargo small { color: #5f6f86; font-size: 12px; font-weight: 600; }

.ff-options {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ff-options li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #edf0f4;
  border-radius: 8px;
  opacity: 0.38;
  transition: opacity 0.3s, border-color 0.3s, background-color 0.3s;
}

.ff-options li.is-on { opacity: 1; }
.ff-options li.is-picked { border-color: var(--t); background: var(--t-bg); }

.ff-options small { display: block; color: #8a97ab; font-size: 10.5px; font-weight: 600; }
.ff-options b { display: block; font-size: 13px; }
.ff-options strong {
  display: block;
  color: #14283f;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.ff-options em {
  display: block;
  color: #08785d;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.ff-chain {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 12px 6px 10px;
  border: 1px solid #edf0f4;
  border-radius: 10px;
  background: #fafbfc;
  list-style: none;
  opacity: 0.38;
  transition: opacity 0.3s;
}

.ff-chain.is-on { opacity: 1; }

.ff-chain::before {
  position: absolute;
  top: 26px;
  right: 18%;
  left: 18%;
  height: 2px;
  background: #e1e6ec;
  content: '';
}

.ff-chain li {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #5f6f86;
  font-size: 11.5px;
  font-weight: 600;
}

.ff-chain li span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--t);
  color: #fff;
  line-height: 0;
}

.ff-chain .icon { display: block; width: 14px; height: 14px; }

.ff-equip {
  display: inline-flex;
  align-self: start;
  margin: auto 0 0;
  padding: 6px 10px;
  border: 1px dashed #c9d5c4;
  border-radius: 8px;
  background: #fff;
  color: #08785d;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.38;
  transition: opacity 0.3s;
}

.ff-equip.is-on { opacity: 1; }

.ff-record dl { margin: 0; }

.ff-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 4px;
  border-top: 1px solid #f0f3f6;
  border-radius: 6px;
  font-size: 12.5px;
}

.ff-row dt { color: #7b8798; font-size: 12px; white-space: nowrap; }
.ff-row dd { overflow: hidden; margin: 0; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.ff-row.is-carried dd { color: var(--t-text); }
.ff-row.is-fresh { animation: ff-flash 1.3s ease; }
.ff-blank { display: block; width: 70%; height: 8px; margin-top: 5px; border-radius: 4px; background: #eef1f5; }
.ff-up { color: #08785d; }

.ff-legs { display: inline-flex; align-items: center; gap: 4px; }

.ff-legs i {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
}

.ff-legs i.is-road { background: #e08a1e; }
.ff-legs i.is-ocean { background: #1768ed; }
.ff-legs .icon { width: 11px; height: 11px; }

.ff-link { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 8px; }

@media (min-width: 881px) {
  .ff-link {
    align-self: stretch;
    display: grid;
    grid-template-rows: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
    padding: 12px 8px;
  }

  .ff-link-label { align-self: end; }
  .ff-link-line { width: 100%; }
  .ff-link-carry { align-self: start; }
}
.ff-link-label { color: #8a97ab; font-size: 11px; font-weight: 600; text-align: center; transition: color 0.2s; }
.ff-link.is-live .ff-link-label,
.ff-link.is-done .ff-link-label { color: #1658c0; }

.ff-link-line { position: relative; display: block; width: 100%; height: 2px; border-radius: 2px; background: #d6dfea; }

.ff-link-line span {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: #1768ed;
  transform: scaleX(0);
  transform-origin: left;
}

.ff-link.is-live .ff-link-line span { transform: scaleX(1); transition: transform 1.2s linear; }
.ff-link.is-done .ff-link-line span { transform: scaleX(1); }

.ff-packet {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1768ed;
  box-shadow: 0 0 0 4px #d7e5fc;
  opacity: 0;
  transform: translate(-50%, -50%);
}

.ff-link.is-live .ff-packet { animation: ff-travel 1.2s linear both; }
.ff-link-carry { color: #8a97ab; font-size: 10.5px; line-height: 1.35; text-align: center; }
.ff-link.is-live .ff-link-carry { color: #1658c0; }

.ff-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.ff-stages li { padding-top: 14px; border-top: 2px solid #dce5ee; transition: border-color 0.3s; }
.ff-stages li > span { color: #7d8ba2; font-size: 12px; font-weight: 600; }
.ff-stages h3 { margin: 2px 0 4px; font-size: 17px; }
.ff-stages p { font-size: 13.5px; line-height: 1.6; }
.ff-stages li:nth-child(1).is-active { border-color: #e08a1e; }
.ff-stages li:nth-child(2).is-active { border-color: #1768ed; }
.ff-stages li:nth-child(3).is-active { border-color: #0c9a6a; }

@keyframes ff-pop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
@keyframes ff-flash { from { background: var(--t-soft); } to { background: transparent; } }

@keyframes ff-travel {
  0% { left: 0; opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

/* ── Portiom AI in TMS ─────────────────────────────────────────────────── */

.tai-section {
  padding: 100px 0 90px;
  border-block: 1px solid #e8eef5;
  background: #f6f9fc;
  scroll-margin-top: 95px;
}

.tai-heading { max-width: 700px; margin-bottom: 44px; }
.tai-heading h2 { margin-bottom: 16px; }
.tai-heading p { max-width: 600px; font-size: 15px; line-height: 1.8; }

.tai {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  align-items: center;
  gap: 40px;
}

.tai-threads { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }

.tai-thread {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 0 14px;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid #dce5ee;
  border-radius: 12px;
  background: #fff;
  color: #14283f;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tai-thread:hover { border-color: #bcd0e8; }
.tai-thread:focus-visible { outline: 2px solid #1768ed; outline-offset: 2px; }
.tai-thread.is-active { border-color: #a9c6f5; box-shadow: 0 2px 8px rgb(20 40 63 / 6%); }

.tai-thread-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f0f4f9;
  color: #4b5b73;
  transition: background-color 0.2s, color 0.2s;
}

.tai-thread.is-active .tai-thread-icon { background: #e4edfd; color: #1768ed; }
.tai-thread-icon .icon { width: 19px; height: 19px; }
.tai-thread-text b { display: block; font-size: 15px; }
.tai-thread-text small { display: block; margin-top: 3px; color: #5f6f86; font-size: 13px; line-height: 1.5; }

.tai-thread-bar { grid-column: 2; display: block; height: 3px; margin-top: 12px; overflow: hidden; border-radius: 2px; background: #edf1f6; }

.tai-thread-bar span {
  display: block;
  height: 100%;
  background: #1768ed;
  transform-origin: left;
  animation: tai-bar linear both;
}

.tai-window {
  display: flex;
  flex-direction: column;
  height: 540px;
  overflow: hidden;
  border: 1px solid #d3dfeb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 48px -28px #14283f47, 0 2px 6px #14283f0a;
  color: #14283f;
  text-align: left;
}

.tai-head { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid #eceff3; font-size: 14px; }

.tai-mark {
  display: block;
  flex: none;
  width: 32px;
  height: 32px;
  background: none;
}

.tai-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.tai-head-tools { display: flex; gap: 12px; margin: 0 42px 0 auto; color: #8a97ab; }
.tai-head-tools .icon { width: 16px; height: 16px; }

.tai-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 0;
  overflow: hidden;
  padding: 18px;
  background: #fbfcfe;
}

.tai-feed { display: flex; flex-direction: column; gap: 10px; }

.tai-msg { max-width: 86%; padding: 10px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; }
.tai-msg p { margin: 0; color: inherit; }

.tai-user { align-self: flex-end; border-bottom-right-radius: 4px; background: #1768ed; color: #fff; }

.tai-file {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 7px 10px 7px 8px;
  border-radius: 8px;
  background: #fff;
  color: #14283f;
}

.tai-file .file-glyph { width: 22px; height: 28px; }
.tai-file b { display: block; font-size: 12.5px; }
.tai-file small { display: block; color: #7b8798; font-size: 11px; }

.tai-bot { align-self: flex-start; border: 1px solid #e6ebf1; border-bottom-left-radius: 4px; background: #fff; color: #24384f; }
.tai-bot.is-thinking { padding: 13px 14px; }

.tai-dots { display: flex; gap: 4px; }
.tai-dots i { width: 6px; height: 6px; border-radius: 50%; background: #9aa7b8; animation: tai-dot 1s ease-in-out infinite; }
.tai-dots i:nth-child(2) { animation-delay: 0.15s; }
.tai-dots i:nth-child(3) { animation-delay: 0.3s; }

.tai-steps { display: grid; justify-items: start; gap: 4px; margin: 0; padding: 0; list-style: none; }

.tai-steps li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: #5f6f86;
  font-size: 12px;
  font-weight: 600;
}

.tai-steps .icon { width: 13px; height: 13px; color: #08785d; stroke-width: 2.4; }

.tai-spinner {
  width: 11px;
  height: 11px;
  border: 2px solid #c5d3e4;
  border-top-color: #1768ed;
  border-radius: 50%;
  animation: tai-spin 0.7s linear infinite;
}

.tai-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 2px; }
.tai-fields div { padding: 7px 9px; border-radius: 8px; background: #f4f7fa; }
.tai-fields dt { color: #7b8798; font-size: 10.5px; }
.tai-fields dd { margin: 0; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

.tai-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.tai-table td { padding: 6px 6px; border-top: 1px solid #eef1f5; white-space: nowrap; }
.tai-table td:first-child { padding-left: 0; font-weight: 700; }
.tai-table td:last-child { padding-right: 0; text-align: right; }
.tai-table .num { font-weight: 600; text-align: right; }
.tai-table em { color: #5f6f86; font-size: 11px; font-style: normal; font-weight: 600; }
.tai-table em.is-late { color: #c2341d; }

.tai-word { opacity: 0; animation: tai-word 0.3s ease forwards; }
.tai-msg.is-new,
.tai-steps li.is-new { animation: tai-in 0.3s ease-out; }

.tai-composer { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid #eceff3; color: #8a97ab; }
.tai-composer > .icon { flex: none; width: 18px; height: 18px; }

.tai-input {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 9px 12px;
  border: 1px solid #dfe5ec;
  border-radius: 10px;
  color: #14283f;
  font-size: 13.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: border-color 0.2s;
}

.tai-input.is-typing { border-color: #9fc0f3; }
.tai-placeholder { color: #9aa7b8; }
.tai-caret { display: inline-block; width: 1.5px; height: 15px; margin-left: 1px; background: #1768ed; vertical-align: -2px; animation: tai-caret 1s steps(1) infinite; }

.tai-send {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e8edf3;
  color: #8a97ab;
  transition: background-color 0.2s, color 0.2s;
}

.tai-send.is-ready { background: #1768ed; color: #fff; }
.tai-send .icon { width: 16px; height: 16px; }

.tai-section > .wrap > .product-label { margin-top: 18px; }

@keyframes tai-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes tai-dot { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes tai-spin { to { transform: rotate(360deg); } }
@keyframes tai-word { to { opacity: 1; } }
@keyframes tai-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes tai-caret { 50% { opacity: 0; } }

/* ── Pause toggles ─────────────────────────────────────────────────────── */

.tai-toggle,
.qp-toggle,
.jm-toggle {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #dfe5ec;
  border-radius: 50%;
  background: #fff;
  color: #4b5b73;
  cursor: pointer;
}

.tai-toggle:hover,
.qp-toggle:hover,
.jm-toggle:hover { border-color: #b9c7d8; color: #14283f; }

.tai-toggle:focus-visible,
.qp-toggle:focus-visible,
.jm-toggle:focus-visible { outline: 2px solid #1768ed; outline-offset: 2px; }

.tai-toggle .icon,
.qp-toggle .icon,
.jm-toggle .icon { width: 13px; height: 13px; }

.tai-toggle { top: 12px; right: 12px; }
.qp-toggle { top: 22px; right: 18px; }
.jm-toggle { top: 16px; right: 16px; }

/* ── Quotation profit board ────────────────────────────────────────────── */

.qp { position: relative; }

.qp-board {
  overflow: hidden;
  border: 1px solid #d3dfeb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgb(20 40 63 / 6%);
  color: #14283f;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.qp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 64px 14px 20px;
  border-bottom: 1px solid #e8ecf2;
  background: #fbfcfe;
}

.qp-ref { display: flex; align-items: center; gap: 12px; min-width: 0; }

.qp-ref-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e4edfd;
  color: #1768ed;
}

.qp-ref-icon .icon { width: 17px; height: 17px; }
.qp-ref b { display: block; font-size: 15px; }
.qp-ref small { display: block; color: #7b8798; font-size: 12px; }

.qp-options { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }

.qp-options li {
  min-width: 170px;
  padding: 7px 12px;
  border: 1px solid #e1e7ef;
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.qp-options li.is-active { border-color: #1768ed; box-shadow: 0 0 0 3px #e4edfd; }
.qp-options small { display: block; color: #8a97ab; font-size: 10.5px; font-weight: 600; }
.qp-options b { display: block; font-size: 13px; }
.qp-options span { display: block; color: #7b8798; font-size: 11.5px; }

.qp-body {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-areas:
    'kpis kpis'
    'chart lines'
    'chart compare';
  gap: 0 32px;
  padding: 22px 24px 24px;
}

.qp-kpis { display: grid; grid-area: kpis; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }

.qp-kpi {
  position: relative;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #e8edf3;
  border-radius: 10px;
  background: #fbfcfe;
}

.qp-kpi small { display: block; color: #6c7d95; font-size: 12px; font-weight: 600; }

.qp-kpi strong {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 26px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.qp-kpi strong.is-buy { color: #586b80; }
.qp-kpi.is-profit { border-color: #c6ead4; background: #effaf3; }
.qp-kpi.is-profit strong { color: #08785d; }
.qp-kpi.is-profit .icon { width: 20px; height: 20px; stroke-width: 2.4; }

.qp-delta {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 6px;
  border: 1px solid #c6ead4;
  border-radius: 6px;
  background: #fff;
  color: #08785d;
  font-size: 11.5px;
  font-style: normal;
  font-weight: 700;
  animation: qp-delta 0.95s ease-out both;
}

.qp-spark { position: absolute; right: 14px; bottom: 14px; width: 38%; max-width: 110px; height: 34px; overflow: visible; }
.qp-spark-area { fill: rgb(18 161 80 / 14%); }
.qp-spark-line { fill: none; stroke: #12a150; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

.qp-split { display: block; height: 6px; margin-top: 10px; overflow: hidden; border-radius: 3px; background: #e3e9f0; }
.qp-split span { display: block; height: 100%; border-radius: 3px; background: #12a150; }

.qp-chart-wrap { grid-area: chart; min-width: 0; }

.qp-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 8px; color: #5f6f86; font-size: 12px; font-weight: 600; }
.qp-legend span::before { display: inline-block; width: 14px; height: 3px; margin-right: 6px; border-radius: 2px; vertical-align: middle; content: ''; }
.qp-legend .is-sell::before { background: #12a150; }
.qp-legend .is-buy::before { background: repeating-linear-gradient(90deg, #8a97ab 0 4px, transparent 4px 7px); }
.qp-legend .is-spread::before { width: 10px; height: 10px; border-radius: 2px; background: rgb(18 161 80 / 22%); }
.qp-legend .qp-legend-note { margin-left: auto; color: #8a97ab; font-size: 11.5px; font-weight: 400; }
.qp-legend .qp-legend-note::before { display: none; }

.qp-chart { display: block; width: 100%; height: auto; overflow: visible; }
.qp-grid line { stroke: #edf1f5; stroke-width: 1; }
.qp-grid text { fill: #9aa7b8; font-size: 11px; }
.qp-x { fill: #b3becb; font-size: 11px; transition: fill 0.3s; }
.qp-x.is-on { fill: #4b5b73; font-weight: 600; }
.qp-sell { fill: none; stroke: #12a150; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.qp-buy { fill: none; stroke: #8a97ab; stroke-width: 2; stroke-dasharray: 5 5; }
.qp-tip-sell { fill: #12a150; stroke: #fff; stroke-width: 2; }
.qp-tip-buy { fill: #fff; stroke: #8a97ab; stroke-width: 2; }
.qp-tip-ring { fill: #12a150; opacity: 0.18; transform-box: fill-box; transform-origin: center; animation: qp-ring 1.6s ease-out infinite; }
.qp-bracket { animation: qp-fade 0.4s ease both; }
.qp-bracket line { stroke: #08785d; stroke-width: 1.5; }
.qp-bracket text { fill: #08785d; font-size: 13px; font-weight: 700; }

.qp-lines { grid-area: lines; align-self: start; width: 100%; border-collapse: collapse; font-size: 12.5px; }

.qp-lines th {
  padding: 0 6px 8px;
  border-bottom: 1px solid #e8ecf2;
  color: #8a97ab;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

.qp-lines td { padding: 8px 6px; border-bottom: 1px solid #f0f3f7; white-space: nowrap; }
.qp-lines th:first-child,
.qp-lines td:first-child { padding-left: 0; }
.qp-lines th:last-child,
.qp-lines td:last-child { padding-right: 0; }
.qp-lines td:first-child { font-weight: 600; }
.qp-lines td:nth-child(2) { color: #7b8798; }
.qp-lines .num { text-align: right; }
.qp-lines td.is-up { color: #08785d; font-weight: 700; }
.qp-lines tr { transition: opacity 0.3s; }
.qp-lines tr.is-off td { color: transparent; }
.qp-lines tr.is-off td::before { display: block; width: 70%; height: 8px; margin-bottom: -8px; border-radius: 4px; background: #eef1f5; content: ''; }
.qp-lines tr.is-off td.num::before { margin-left: auto; width: 60%; }
.qp-lines tr.is-fresh td { animation: qp-row 1.1s ease; }

.qp-compare { grid-area: compare; margin-top: 18px; padding-top: 14px; border-top: 1px solid #e8ecf2; }
.qp-compare p { margin: 0 0 8px; color: #6c7d95; font-size: 12px; font-weight: 600; }

.qp-compare-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 118px;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  color: #8a97ab;
  font-size: 12.5px;
  transition: color 0.3s;
}

.qp-compare-row.is-on { color: #14283f; }
.qp-compare-row.is-active > span:first-child { font-weight: 700; }
.qp-compare-row b { color: #9aa7b8; text-align: right; }
.qp-compare-row.is-on b { color: #08785d; }
.qp-compare-bar { display: block; height: 8px; overflow: hidden; border-radius: 4px; background: #eef1f5; }
.qp-compare-bar span { display: block; height: 100%; border-radius: 4px; background: #12a150; transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes qp-delta {
  0% { opacity: 0; transform: translateY(6px); }
  25% { opacity: 1; transform: none; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-6px); }
}

@keyframes qp-ring { 0% { transform: scale(0.6); opacity: 0.35; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes qp-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes qp-row { from { background: #e6f7ed; } to { background: transparent; } }

/* ── Intermodal journey map ────────────────────────────────────────────── */

.jm { position: relative; }

.jm-board {
  overflow: hidden;
  border: 1px solid #d3dfeb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgb(20 40 63 / 6%);
  color: #14283f;
  text-align: left;
}

.jm-top { display: flex; align-items: center; gap: 28px; padding: 14px 64px 14px 20px; border-bottom: 1px solid #e8ecf2; }
.jm-job { flex: none; }
.jm-job b { display: block; font-size: 14px; }
.jm-job small { display: block; color: #7b8798; font-size: 12px; white-space: nowrap; }

.jm-legbar { display: grid; flex: 1; grid-template-columns: 1fr 1.6fr 1fr; gap: 12px; margin: 0; padding: 0; list-style: none; }
.jm-legbar-name { display: flex; align-items: center; gap: 6px; color: #7b8798; font-size: 12px; font-weight: 600; white-space: nowrap; transition: color 0.3s; }
.jm-legbar-name .icon { width: 14px; height: 14px; color: var(--t); }
.jm-legbar li.is-active .jm-legbar-name,
.jm-legbar li.is-done .jm-legbar-name { color: #14283f; }
.jm-legbar-track { display: block; height: 5px; margin-top: 6px; overflow: hidden; border-radius: 3px; background: #edf1f6; }
.jm-legbar-track span { display: block; height: 100%; background: var(--t); transform-origin: left; }

.jm-scene { position: relative; aspect-ratio: 1000 / 320; }
.jm-scene > svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.jm-sea { fill: #cfe4fb; }
.jm-waves path { fill: none; stroke: #9ec4ee; stroke-width: 2; stroke-linecap: round; animation: jm-wave 5s ease-in-out infinite alternate; }
.jm-waves path:nth-child(even) { animation-delay: -2.5s; }
.jm-land { fill: #e4efd2; stroke: #c3d49c; stroke-width: 1.5; }
.jm-region { fill: #6e8a4e; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.jm-path-base { fill: none; stroke: var(--t); stroke-width: 3; stroke-dasharray: 2 8; stroke-linecap: round; opacity: 0.45; }
.jm-path-fill { fill: none; stroke: var(--t); stroke-width: 4.5; stroke-linecap: round; }

.jm-stop { position: absolute; z-index: 1; transform: translate(-50%, -50%); }

.jm-stop i {
  display: block;
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 3px solid #b8c4d3;
  border-radius: 50%;
  background: #fff;
  transition: border-color 0.3s;
}

.jm-stop.is-passed i { border-color: #24384f; }

.jm-stop span {
  position: absolute;
  top: 20px;
  left: 50%;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgb(255 255 255 / 88%);
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%);
}

.jm-stop.is-left span { transform: translateX(-78%); }
.jm-stop.is-start span { left: 8px; transform: none; text-align: left; }
.jm-stop b { display: block; font-size: 12.5px; }
.jm-stop small { display: block; color: #5f6f86; font-size: 11px; }

.jm-vehicle {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--t);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgb(20 40 63 / 35%);
  transform: translate(-50%, -50%);
  transition: background-color 0.3s, box-shadow 0.3s;
  line-height: 0;
}

.jm-vehicle .icon {
  position: static;
  inset: auto;
  display: block;
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
}

.jm-vehicle.is-moving { box-shadow: 0 0 0 6px var(--t-soft), 0 4px 12px -4px rgb(20 40 63 / 35%); }

.jm-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  grid-template-areas:
    'head facts'
    'head miles';
  gap: 16px 32px;
  padding: 20px 22px 22px;
  border-top: 1px solid #e8ecf2;
  background: #fff;
}

.jm-detail.is-entering { animation: jm-in 0.35s ease; }

.jm-detail-head { display: grid; grid-area: head; grid-template-columns: 44px minmax(0, 1fr); align-items: start; gap: 0 14px; }

.jm-detail-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--t);
  color: #fff;
}

.jm-detail-icon .icon { width: 20px; height: 20px; }
.jm-detail-head small { display: block; color: var(--t-text); font-size: 12px; font-weight: 600; }
.jm-detail-head b { display: block; margin-top: 1px; font-size: 18px; letter-spacing: -0.01em; }
.jm-detail-route { display: block; margin-top: 2px; color: #4b5b73; font-size: 13px; }
.jm-detail-head .jm-status { grid-column: 2; justify-self: start; margin-top: 10px; }

.jm-facts { display: grid; grid-area: facts; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0; }
.jm-facts div { min-width: 0; }
.jm-facts dt { color: #8a97ab; font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.jm-facts dd { overflow: hidden; margin: 3px 0 0; font-size: 13px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }

.jm-milestones { display: flex; flex-wrap: wrap; grid-area: miles; gap: 8px; margin: 0; padding: 0; list-style: none; }

.jm-milestones li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid #e1e7ef;
  border-radius: 999px;
  background: #fff;
  color: #8a97ab;
  font-size: 12px;
  font-weight: 600;
  transition: color 0.3s, border-color 0.3s;
}

.jm-milestones .icon { width: 13px; height: 13px; }
.jm-milestones li.is-reached { border-color: var(--t); color: var(--t-text); }
.jm-milestones li.is-reached .icon { color: var(--t); stroke-width: 2.4; }

@keyframes jm-wave { from { transform: translateX(0); } to { transform: translateX(16px); } }
@keyframes jm-in { from { opacity: 0; } to { opacity: 1; } }

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {

  .ff-track { grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr) 72px minmax(0, 1fr); }
  .ff-board { padding: 20px; }
  .ff-row { grid-template-columns: 92px minmax(0, 1fr); }

  .qp-top { flex-wrap: wrap; }
  .qp-kpi strong { font-size: 22px; }
  .qp-lines th:nth-child(2),
  .qp-lines td:nth-child(2) { display: none; }

  .jm-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 880px) {

  .tms-head { flex-direction: column; align-items: flex-start; gap: 20px; margin-bottom: 28px; }
  .ff-track { grid-template-columns: minmax(0, 1fr); }
  .ff-record.is-waiting { opacity: 0.6; }

  .ff-link {
    flex-direction: row;
    justify-content: flex-start;
    gap: 14px;
    height: 54px;
    padding: 0 0 0 30px;
  }

  .ff-link-line { order: -1; width: 2px; height: 100%; }
  .ff-packet { display: none; }
  .ff-link-line span { transform: scaleY(0); transform-origin: top; }
  .ff-link.is-live .ff-link-line span,
  .ff-link.is-done .ff-link-line span { transform: scaleY(1); }
  .ff-stages { grid-template-columns: minmax(0, 1fr); gap: 16px; }

  .tai { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .tai-window { height: 500px; }
  .tai-toggle { top: auto; bottom: 459px; }

  .qp-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'kpis' 'chart' 'lines' 'compare';
    gap: 0;
  }

  .qp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qp-lines { margin-top: 20px; }
  .qp-lines th:nth-child(2),
  .qp-lines td:nth-child(2) { display: table-cell; }

  .jm-top { flex-direction: column; align-items: stretch; gap: 12px; }
  .jm-detail { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'head' 'facts' 'miles'; }
}

@media (max-width: 540px) {

  .ff-board { padding: 14px; }
  .ff-row { grid-template-columns: 76px minmax(0, 1fr); font-size: 12px; }

  .tai-section { padding: 64px 0; }
  .tai-thread { padding: 14px; }
  .tai-thread-text small { font-size: 12.5px; }
  .tai-window { height: 470px; }
  .tai-toggle { bottom: 429px; }
  .tai-msg { max-width: 92%; font-size: 13px; }
  .tai-fields { grid-template-columns: minmax(0, 1fr); }
  .tai-table td:nth-child(2) { display: none; }

  .qp-top { padding: 14px 56px 14px 14px; }
  .qp-options { flex-direction: column; width: 100%; }
  .qp-options li { min-width: 0; }
  .qp-body { padding: 16px 14px 18px; }
  .qp-kpi { padding: 12px; }
  .qp-kpi strong { font-size: 19px; }
  .qp-delta,
  .qp-spark { display: none; }
  .qp-lines th:nth-child(2),
  .qp-lines td:nth-child(2) { display: none; }
  .qp-compare-row { grid-template-columns: minmax(0, 1fr) 110px; }
  .qp-compare-bar { display: none; }

  .jm-top { padding: 14px 56px 14px 14px; }
  .jm-legbar { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .jm-legbar-name { font-size: 0; }
  .jm-legbar-name .icon { width: 16px; height: 16px; }
  .jm-stop b { font-size: 10px; }
  .jm-stop small { display: none; }
  .jm-stop span { top: 14px; padding: 1px 4px; }
  .jm-stop.is-start span { top: auto; bottom: 14px; }
  .jm-vehicle { width: 30px; height: 30px; border-width: 2px; }
  .jm-vehicle .icon { width: 14px; height: 14px; }
  .jm-detail { padding: 16px 14px; }
  .jm-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .ff-status,
  .ff-row.is-fresh,
  .tai-msg.is-new,
  .tai-steps li.is-new,
  .tai-dots i,
  .tai-spinner,
  .tai-caret,
  .qp-tip-ring,
  .qp-bracket,
  .qp-delta,
  .qp-lines tr.is-fresh td,
  .jm-waves path,
  .jm-detail.is-entering { animation: none; }

  .ff-record,
  .ff-link-line span,
  .qp-compare-bar span,
  .jm-vehicle { transition: none; }
}
