/* ==========================================================================
   Platform page only — the LiDAR panel, the live tracking demo and the
   stockpile tiles.
   ========================================================================== */

/* --- LiDAR loading panel -------------------------------------------------- */
.lidar-card { background: var(--forest); border-color: rgba(255,255,255,.12); padding: 26px; }
.lidar-readout { gap: 10px; margin-top: 18px; }
.lidar-readout .ro {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px; padding: 12px 14px;
}
.lidar-readout .ro .k { font-size: .66rem; letter-spacing: .09em; text-transform: uppercase; color: rgba(255,255,255,.5); margin-bottom: 5px; }
.lidar-readout .ro .v { font-family: var(--font-mono); font-size: 1.1rem; color: #fff; }
.lidar-readout .ro .v.up { color: #6fd3a4; }

@media (prefers-reduced-motion: reduce) {
  .lidar-card svg animate,
  .lidar-card svg animateTransform { display: none; }
}

/* --- live tracking demo --------------------------------------------------- */
#bt-root {
  background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}

.bt-bar {
  display: flex; align-items: center; gap: 14px; padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft); background: var(--surface-2); flex-wrap: wrap;
}
.bt-bar .t { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: .98rem; }
.bt-bar .live { margin-left: auto; display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; color: var(--good); }
.bt-bar .live i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); animation: pulse 2.2s infinite; font-style: normal; }
.bt-bar .demo-tag {
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; background: var(--warn-soft); color: #9a3412;
}

.bt-main { display: grid; grid-template-columns: 1fr 340px; min-height: 580px; }
.bt-map-col { position: relative; min-height: 580px; }
#bt-map { position: absolute; inset: 0; background: #dce9f5; }
.bt-map-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; color: var(--muted); font-size: .92rem; }

.bt-mapbtns { position: absolute; top: 12px; right: 12px; z-index: 500; }
.bt-mapbtns button {
  padding: 8px 15px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(255,255,255,.94); backdrop-filter: blur(4px);
  font-family: var(--font-display); font-size: .82rem; font-weight: 500; color: var(--ink-2); cursor: pointer;
}
.bt-mapbtns button:hover { border-color: var(--brand); color: var(--brand); }

.bt-legend {
  position: absolute; left: 12px; bottom: 22px; z-index: 500;
  background: rgba(255,255,255,.94); backdrop-filter: blur(4px);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px;
  font-size: .76rem; line-height: 1.9; color: var(--ink-2);
}
.bt-legend b { display: block; font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.bt-legend span { display: flex; align-items: center; gap: 8px; }

.bt-swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.bt-swatch--loading   { background: #f59e0b; }
.bt-swatch--transit   { background: #046bd2; }
.bt-swatch--waiting   { background: #0d9488; }
.bt-swatch--unloading { background: #0891b2; }
.bt-swatch--empty     { background: #64748b; }

.bt-rail { border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; background: var(--surface-2); }
.bt-rail-tabs { display: flex; border-bottom: 1px solid var(--line-soft); background: #fff; }
.bt-rail-tabs button {
  flex: 1; padding: 14px 8px; border: none; background: none; cursor: pointer;
  font-family: var(--font-display); font-size: .84rem; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent;
}
.bt-rail-tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.bt-rail-body { padding: 16px; overflow-y: auto; max-height: 580px; }

.bt-block { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 15px; margin-bottom: 12px; box-shadow: var(--shadow); }
.bt-block--total { background: var(--brand-tint); border-color: #c7d9ef; }
.bt-block-t { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 12px; }

.bt-fc { display: grid; gap: 9px; }
.bt-fc-i { display: flex; align-items: center; gap: 9px; font-size: .85rem; color: var(--muted); }
.bt-fc-i b { font-family: var(--font-mono); color: var(--ink); min-width: 20px; font-size: .95rem; }
.bt-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }

.bt-kv { display: flex; align-items: baseline; gap: 10px; font-size: .85rem; color: var(--muted); padding: 4px 0; }
.bt-kv b { margin-left: auto; color: var(--ink); font-weight: 600; text-align: right; }

.bt-meter { position: relative; height: 8px; border-radius: 99px; background: #e9edf3; overflow: visible; margin-top: 8px; }
.bt-meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #4f6dff); transition: width .5s ease; }
.bt-meter u { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--warn); }

.bt-note { font-size: .74rem; color: var(--muted-2); margin-top: 7px; line-height: 1.5; }
.bt-note--center { text-align: center; margin-top: 16px; font-size: .82rem; }

.bt-site + .bt-site { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line-soft); }
.bt-site-h { display: flex; align-items: baseline; gap: 8px; font-size: .84rem; margin-bottom: 7px; }
.bt-site-h b { color: var(--ink); font-weight: 600; }
.bt-site-h span { margin-left: auto; color: var(--muted); font-size: .8rem; }
.bt-track { height: 6px; border-radius: 99px; background: #e9edf3; overflow: hidden; }
.bt-track i { display: block; height: 100%; border-radius: 99px; transition: width .5s ease; }

.bt-dem { padding: 11px 0; cursor: pointer; border-radius: 8px; }
.bt-dem + .bt-dem { border-top: 1px solid var(--line-soft); }
.bt-dem:hover { background: var(--brand-tint); }
.bt-dem:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.bt-dem-h { display: flex; align-items: center; gap: 9px; font-size: .87rem; }
.bt-dem-h b { color: var(--ink); font-family: var(--font-mono); }
.bt-badge { margin-left: auto; font-size: .68rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }

.bt-flag { margin-top: 14px; padding: 11px 13px; border-radius: 9px; background: var(--warn-soft); border: 1px solid #fcd9a8; font-size: .81rem; color: #9a3412; line-height: 1.5; }

.bt-drawer {
  position: absolute; top: 56px; right: 16px; bottom: auto; width: 300px; z-index: 600;
  max-height: calc(100% - 80px);
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15,23,42,.16);
  display: flex; flex-direction: column;
  visibility: hidden; pointer-events: none; opacity: 0;
  transform: translateY(8px); transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.bt-drawer.open {
  visibility: visible; pointer-events: auto; opacity: 1; transform: none;
}
.bt-drawer-h { padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.bt-drawer-h .e { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); font-weight: 600; }
.bt-drawer-h h4 { margin: 5px 0 0; font-family: var(--font-mono); font-size: 1.15rem; }
.bt-drawer-h button {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer;
  color: var(--muted); font-size: 1rem; line-height: 1;
}
.bt-drawer-h button:hover { border-color: var(--brand); color: var(--brand); }
.bt-drawer-b { padding: 18px 20px; overflow-y: auto; }

.bt-barge i {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  color: #fff; font-family: var(--font-mono); font-size: .74rem;
  border: 2px solid rgba(255,255,255,.9); font-style: normal; box-sizing: border-box;
}
.bt-terminal i {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  color: #fff; font-family: var(--font-display); font-size: .82rem; font-weight: 700;
  border: 2px solid #fff; font-style: normal; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.bt-lbl span {
  display: inline-block; white-space: nowrap; font-family: var(--font-mono); font-size: .66rem;
  color: var(--ink-2); background: rgba(255,255,255,.82); padding: 1px 5px; border-radius: 4px;
}
.leaflet-container { font-family: var(--font-body); }

@media (max-width: 1000px) {
  .bt-main { grid-template-columns: 1fr; }
  .bt-map-col { min-height: 420px; height: 420px; }
  .bt-rail { border-left: none; border-top: 1px solid var(--line-soft); }
  .bt-rail-body { max-height: none; }
  .bt-drawer { width: calc(100% - 24px); right: 12px; left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .bt-bar .live i { animation: none; }
  .bt-drawer { transition: none; }
}

/* --- stockpile tiles ------------------------------------------------------ */
.pile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pile { background: #fff; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 20px; box-shadow: var(--shadow); }
.pile-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.pile-h b { font-family: var(--font-display); color: var(--ink); font-size: 1rem; }
.pile-h span { margin-left: auto; font-family: var(--font-mono); font-size: .82rem; color: var(--muted); }
.pile .v { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; color: var(--brand); letter-spacing: -.02em; }
.pile .u { font-size: .8rem; color: var(--muted); margin-left: 4px; font-weight: 400; }
.pile .bar { height: 7px; border-radius: 99px; background: #e9edf3; overflow: hidden; margin: 14px 0 8px; }
.pile .bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #4f6dff); }

@media (max-width: 860px) { .pile-grid { grid-template-columns: 1fr; } }
