/* GX Tracking 0.10.45 — one history visual language, desktop-adjusted.
   Only selected History pane. No map, mobile sheet or API changes. */
/* Rounded restart icon on mobile and desktop; button semantics stay intact. */
body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyRestartButton::before {
  content: '' !important;
  display: block !important;
  flex: 0 0 auto !important;
  width: 24px !important;
  height: 24px !important;
  font-size: 0 !important;
  margin: 0 !important;
  background: currentColor !important;
  /* Lucide-style circular return; avoids the downward-pointing Unicode glyph */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8V3m0 5h5'/%3E%3Cpath d='M3 8a9 9 0 1 1 2.7 6.45'/%3E%3C/svg%3E") center / contain no-repeat !important;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8V3m0 5h5'/%3E%3Cpath d='M3 8a9 9 0 1 1 2.7 6.45'/%3E%3C/svg%3E") center / contain no-repeat !important;
}
body.tracking-dashboard #historyPanel #historyRestartButton {font-size:0!important;}
@media(max-width:850px){
  body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyRestartButton::before {
    width:21px!important;height:21px!important;
  }
}
@media(min-width:851px){
  body.tracking-dashboard #historyPanel {
    --gx-hist-45-surface:#102334;
    --gx-hist-45-active:#163b58;
    --gx-hist-45-border:#34546e;
    --gx-hist-45-ink:#e6f0fa;
    --gx-hist-45-muted:#a3bbd1;
    --gx-hist-45-blue:#0788fa;
    color:var(--gx-hist-45-ink)!important;
    background:transparent!important;
    padding:12px 11px 15px!important;
    min-width:0;
  }
  /* Keep existing desktop sidebar, device header and tabs. Hide only duplicated
     history content that was replaced on mobile, while leaving API calls intact. */
  body.tracking-dashboard #historyPanel .history-mobile-controls>.inspector-section-head,
  body.tracking-dashboard #historyPanel #historyCurrentInfo,
  body.tracking-dashboard #historyPanel #historyGeofenceSection{display:none!important;}
  body.tracking-dashboard #historyPanel #historyPeriodActions {
    display:flex!important;align-items:stretch!important;flex-wrap:wrap!important;
    width:100%!important;gap:6px!important;margin:0 0 13px!important;
    padding:0!important;min-width:0!important;
  }
  body.tracking-dashboard #historyPanel #historyPeriodActions>button {
    display:inline-flex!important;align-items:center!important;justify-content:center!important;
    flex:1 1 60px!important;min-width:0!important;
    padding:8px 7px!important;margin:0!important;min-height:38px!important;
    border:1px solid var(--gx-hist-45-border)!important;border-radius:10px!important;
    background:var(--gx-hist-45-surface)!important;color:var(--gx-hist-45-ink)!important;
    font-size:11px!important;line-height:1.25!important;font-weight:650!important;
    white-space:nowrap!important;box-shadow:none!important;
  }
  body.tracking-dashboard #historyPanel #historyPeriodActions>button[data-period=custom] {flex-grow:1.35!important;}
  body.tracking-dashboard #historyPanel #historyPeriodActions>button.active {
    border-color:#168fff!important;background:var(--gx-hist-45-blue)!important;color:#fff!important;
  }
  /* Network selector is separate on desktop by existing contract; style it as a
     compact companion, never as a full-width legacy row or an empty placeholder. */
  body.tracking-dashboard #historyPanel #gxHistoryNetworkFilter {
    margin:0 0 10px!important;padding:0!important;width:100%!important;
    background:transparent!important;border:0!important;
  }
  body.tracking-dashboard #historyPanel #gxHistoryNetworkFilter label {
    display:flex!important;align-items:center!important;gap:8px!important;
    margin:0!important;font-size:11px!important;color:var(--gx-hist-45-muted)!important;
  }
  body.tracking-dashboard #historyPanel #gxHistoryNetworkFilter label>span {flex:0 0 auto;}
  body.tracking-dashboard #historyPanel #gxHistoryNetworkSelect {
    min-width:0!important;width:auto!important;flex:1 1 auto!important;
    min-height:34px!important;margin:0!important;padding:5px 8px!important;
    border:1px solid var(--gx-hist-45-border)!important;border-radius:9px!important;
    background:var(--gx-hist-45-surface)!important;color:var(--gx-hist-45-ink)!important;
    font-size:12px!important;
  }
  body.tracking-dashboard #historyPanel #historyCustom{
    grid-template-columns:minmax(0,1fr)!important;gap:8px!important;
    padding:10px!important;border:1px solid var(--gx-hist-45-border)!important;
    border-radius:11px!important;background:var(--gx-hist-45-surface)!important;
  }
  body.tracking-dashboard #historyPanel #historyPlayback {
    display:flex!important;flex-direction:column!important;align-items:stretch!important;
    padding:0!important;margin:0!important;gap:0!important;min-width:0!important;
    background:transparent!important;border:0!important;box-shadow:none!important;
  }
  body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons {
    width:100%!important;display:flex!important;justify-content:space-evenly!important;
    align-items:center!important;gap:8px!important;padding:3px 2px 0!important;margin:0!important;
  }
  body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons>button {
    display:inline-flex!important;align-items:center!important;justify-content:center!important;
    flex:0 0 42px!important;min-width:42px!important;width:42px!important;
    min-height:42px!important;height:42px!important;padding:0!important;margin:0!important;
    border:1px solid var(--gx-hist-45-border)!important;border-radius:50%!important;
    background:var(--gx-hist-45-surface)!important;color:var(--gx-hist-45-ink)!important;
    font-size:14px!important;font-weight:700!important;line-height:1!important;
    box-shadow:none!important;
  }
  body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyRestartButton{order:1!important;font-size:0!important;}
  body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyPlayButton{
    order:2!important;flex-basis:56px!important;width:56px!important;
    min-width:56px!important;height:56px!important;min-height:56px!important;
    border-color:#149aff!important;background:var(--gx-hist-45-blue)!important;
    color:#fff!important;font-size:0!important;
  }
  body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyPlayButton::before{
    content:'▶'!important;font-family:Arial,sans-serif!important;font-size:23px!important;
    margin-left:3px!important;color:#fff!important;
  }
  body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyPlayButton[data-gx-playing='1']::before{
    content:'Ⅱ'!important;font-size:23px!important;margin-left:0!important;
  }
  body.tracking-dashboard #historyPanel #gxHistorySpeedCycleV01037{
    order:3!important;display:inline-flex!important;visibility:visible!important;
  }
  body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons>button:disabled{
    opacity:.42!important;cursor:not-allowed!important;
  }
  /* Preserve the desktop-specific 'Zoom automático' action in a compact row;
     only the legacy speed dropdown is redundant with the round speed button. */
  body.tracking-dashboard #historyPanel #historyPlayback .history-playback-options {
    display:flex!important;justify-content:center!important;align-items:center!important;
    padding:0!important;margin:5px 0 0!important;gap:8px!important;
  }
  body.tracking-dashboard #historyPanel #historyPlayback .history-zoom-control{
    display:flex!important;align-items:center!important;justify-content:center!important;
    gap:8px!important;min-width:0!important;
  }
  body.tracking-dashboard #historyPanel #historyPlayback #historySpeed,
  body.tracking-dashboard #historyPanel #historyPlaybackTime{display:none!important;}
  body.tracking-dashboard #historyPanel #historyZoomStatus{
    font-size:10px!important;color:var(--gx-hist-45-muted)!important;
  }
  body.tracking-dashboard #historyPanel #historyZoomAutoButton{
    min-height:25px!important;padding:3px 7px!important;border-radius:8px!important;
    font-size:10px!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-timeline-v01037{
    display:grid!important;grid-template-columns:auto minmax(0,1fr) auto!important;
    align-items:center!important;gap:7px!important;margin:12px 0 6px!important;
    padding:0!important;min-width:0!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-timeline-time{
    display:block!important;color:var(--gx-hist-45-muted)!important;
    font-size:10px!important;font-variant-numeric:tabular-nums!important;white-space:nowrap!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-timeline-v01037 #historyProgress{
    appearance:none!important;min-width:0!important;width:100%!important;height:30px!important;
    margin:0!important;padding:0!important;background:transparent!important;
    accent-color:var(--gx-hist-45-blue)!important;
  }
  body.tracking-dashboard #historyProgress::-webkit-slider-runnable-track {
    height:6px;border-radius:8px;background:linear-gradient(to right,#0788fa var(--history-progress-pct,0%),#34516c var(--history-progress-pct,0%));
  }
  body.tracking-dashboard #historyProgress::-webkit-slider-thumb {
    appearance:none;width:18px;height:18px;margin-top:-6px;border-radius:50%;
    border:3px solid white;background:#0788fa;
  }
  body.tracking-dashboard #historyProgress::-moz-range-track {
    height:6px;border-radius:8px;background:linear-gradient(to right,#0788fa var(--history-progress-pct,0%),#34516c var(--history-progress-pct,0%));
  }
  body.tracking-dashboard #historyProgress::-moz-range-thumb {
    width:15px;height:15px;border:3px solid white;border-radius:50%;background:#0788fa;
  }
  body.tracking-dashboard #historyPanel .history-list-section{
    margin:12px 0 0!important;padding:12px 0 0!important;
    border-top:1px solid var(--gx-hist-45-border)!important;
  }
  body.tracking-dashboard #historyPanel .history-list-head{
    margin:0 0 9px!important;padding:0!important;
  }
  body.tracking-dashboard #historyPanel .history-list-head strong{
    font-size:15px!important;line-height:1.3!important;color:var(--gx-hist-45-ink)!important;
  }
  body.tracking-dashboard #historyPanel #historyListMeta{
    font-size:11px!important;color:var(--gx-hist-45-muted)!important;margin-top:3px!important;
  }
  body.tracking-dashboard #historyPanel #historyPositionList{
    display:flex!important;flex-direction:column!important;gap:7px!important;
    max-height:clamp(240px,48vh,620px)!important;overflow-y:auto!important;
    min-width:0!important;padding:0 3px 10px 0!important;
    overscroll-behavior:contain;scrollbar-width:thin;
  }
  body.tracking-dashboard #historyPanel #historyPositionList .gx-history-card-v01037{
    display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;
    flex:0 0 auto!important;align-items:center!important;gap:7px!important;
    width:100%!important;min-width:0!important;min-height:62px!important;
    padding:9px 9px!important;border:1px solid var(--gx-hist-45-border)!important;
    border-radius:11px!important;background:var(--gx-hist-45-surface)!important;
    color:var(--gx-hist-45-ink)!important;box-shadow:none!important;cursor:pointer!important;
  }
  body.tracking-dashboard #historyPanel #historyPositionList .gx-history-card-v01037.active{
    background:var(--gx-hist-45-active)!important;border-color:#079bff!important;
    box-shadow:inset 0 0 0 1px rgba(7,155,255,.45)!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-card-main-v01037{
    display:flex!important;flex-direction:column!important;gap:4px!important;min-width:0!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-card-line-v01037{
    display:flex!important;align-items:center!important;gap:9px!important;
    font-size:11px!important;white-space:nowrap!important;font-weight:700!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-card-line-v01037 time{font-variant-numeric:tabular-nums!important;}
  body.tracking-dashboard #historyPanel .gx-history-card-coords-v01037{
    display:block!important;font-size:10px!important;line-height:1.3!important;
    color:var(--gx-hist-45-muted)!important;overflow:hidden;text-overflow:ellipsis;
    white-space:nowrap!important;min-width:0!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-card-right-v01037{
    display:flex!important;align-items:center!important;justify-content:flex-end!important;
    gap:4px!important;flex:0 0 auto!important;min-width:0!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-card-number-v01037{
    display:inline-grid!important;place-items:center!important;min-width:33px!important;
    width:auto!important;height:28px!important;padding:0 7px!important;
    border:1px solid #42637c!important;border-radius:999px!important;
    color:var(--gx-hist-45-ink)!important;font-size:11px!important;
    font-variant-numeric:tabular-nums!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-card-v01037.active .gx-history-card-number-v01037{
    color:#fff!important;background:var(--gx-hist-45-blue)!important;border-color:var(--gx-hist-45-blue)!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-origin-v01037{
    display:inline-flex!important;align-items:center!important;gap:2px!important;
    color:var(--gx-hist-45-ink)!important;white-space:nowrap!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-origin-v01037 svg{
    display:block!important;width:15px!important;height:15px!important;fill:currentColor!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-fence-v01037 {
    display:inline-grid!important;place-items:center!important;min-height:22px!important;
    min-width:22px!important;height:22px!important;padding:0!important;
    border:1px solid #426783!important;border-radius:50%!important;
    background:#163448!important;color:#9be6bb!important;font-size:11px!important;
  }
  body.tracking-dashboard #historyPanel .gx-history-fence-v01037.exit{color:#ffb4a0!important;border-color:#8b5257!important;}
  body.tracking-dashboard #historyPanel .gx-history-event-details-v01037{
    grid-column:1/-1;padding-top:8px;border-top:1px solid var(--gx-hist-45-border);
    font-size:11px;line-height:1.45;
  }
  body.tracking-dashboard #historyPanel .gx-history-event-details-v01037 small{display:block;color:var(--gx-hist-45-muted);}
  body.tracking-dashboard #historyPanel .gx-history-card-v01037:focus-visible,
  body.tracking-dashboard #historyPanel #historyPlayback button:focus-visible{
    outline:2px solid #4cb4ff!important;outline-offset:2px!important;
  }
  /* Theme-specific readable surfaces (including controls and cards). */
  html[data-theme='light'] body.tracking-dashboard #historyPanel{
    --gx-hist-45-surface:#ffffff;
    --gx-hist-45-active:#e8f3ff;
    --gx-hist-45-border:#c6d8e7;
    --gx-hist-45-ink:#193248;
    --gx-hist-45-muted:#56738e;
  }
}
