/* GX Tracking 0.10.38 — Mobile History targeted refinements.
   Preserve v0.10.37 dark layout, desktop layout and Leaflet viewport.
*/
@media(max-width:850px){
  /* The real back control was still visible in some builds due to inherited CSS. */
  html body.tracking-dashboard .device-inspector.mobile-history-mode #deviceInspectorBack{
    display:none!important;visibility:hidden!important;width:0!important;
    min-width:0!important;margin:0!important;padding:0!important;
  }
  html body.tracking-dashboard .device-inspector.mobile-history-mode .device-inspector-head{
    grid-template-columns:42px minmax(0,1fr)!important;
  }
  /* Entrack network selector stays immediately after Personalizado.
     Small devices use horizontal scrolling instead of wrapping it underneath. */
  html body.tracking-dashboard #historyPeriodActions{
    display:flex!important;flex-wrap:nowrap!important;align-items:stretch!important;
    gap:6px!important;overflow-x:auto!important;overflow-y:hidden!important;
    scroll-behavior:smooth;scrollbar-width:none;-webkit-overflow-scrolling:touch;
    padding-bottom:2px!important;
  }
  html body.tracking-dashboard #historyPeriodActions::-webkit-scrollbar{display:none}
  html body.tracking-dashboard #historyPeriodActions>button{
    flex:1 0 auto!important;white-space:nowrap!important;
    min-width:0!important;padding:7px 8px!important;
  }
  html body.tracking-dashboard #historyPeriodActions #gxHistoryNetworkFilter{
    flex:0 0 auto!important;min-width:80px!important;max-width:118px!important;
    margin:0!important;align-self:stretch!important;
  }
  html body.tracking-dashboard #historyPeriodActions #gxHistoryNetworkSelect{
    width:auto!important;min-width:78px!important;max-width:118px!important;
    padding:4px!important;
  }
  /* Reduce the three circular controls by approximately 30%, without
     shrinking the physical timeline thumb or sacrificing spacing. */
  html body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons>button{
    flex:0 0 42px!important;width:42px!important;height:42px!important;
    min-width:42px!important;min-height:42px!important;
  }
  html body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyPlayButton{
    flex:0 0 55px!important;width:55px!important;height:55px!important;
    min-width:55px!important;min-height:55px!important;
  }
  html body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyRestartButton::before{
    font-size:25px!important;
  }
  html body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyPlayButton::before{
    font-size:24px!important;margin-left:3px!important;
  }
  html body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyPlayButton[data-gx-playing="1"]::before{
    font-size:23px!important;margin-left:0!important;
  }
  html body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #gxHistorySpeedCycleV01037{
    font-size:14px!important;
  }
  html body.tracking-dashboard #historyPanel .gx-history-timeline-v01037{
    margin-top:26px!important;
  }
}
@media(max-width:380px){
  html body.tracking-dashboard #historyPeriodActions>button{
    font-size:11px!important;padding:6px!important;
  }
  html body.tracking-dashboard #historyPeriodActions #gxHistoryNetworkFilter{
    min-width:75px!important;
  }
  html body.tracking-dashboard #historyPeriodActions #gxHistoryNetworkSelect{
    min-width:73px!important;font-size:11px!important;
  }
}
/* Light theme: explicit overrides of the hard-coded navy styles from 0.10.37.
   Dark theme is untouched. Selected controls remain in GX blue. */
@media(max-width:850px){
  html[data-theme="light"] body.tracking-dashboard .device-inspector.mobile-history-mode{
    background:#f8fbff!important;color:#1c3148!important;
    border-color:#d8e3ef!important;
  }
  html[data-theme="light"] body.tracking-dashboard .device-inspector.mobile-history-mode .device-inspector-head,
  html[data-theme="light"] body.tracking-dashboard .device-inspector.mobile-history-mode .device-inspector-content,
  html[data-theme="light"] body.tracking-dashboard .device-inspector.mobile-history-mode .inspector-panels,
  html[data-theme="light"] body.tracking-dashboard #historyPanel{
    background:#f8fbff!important;color:#1c3148!important;
  }
  html[data-theme="light"] body.tracking-dashboard .device-inspector.mobile-history-mode .device-inspector-heading strong,
  html[data-theme="light"] body.tracking-dashboard #historyPanel .history-list-head strong{
    color:#1b2e43!important;
  }
  html[data-theme="light"] body.tracking-dashboard .device-inspector.mobile-history-mode .device-inspector-heading .muted,
  html[data-theme="light"] body.tracking-dashboard #historyPanel #historyListMeta{
    color:#52677e!important;
  }
  html[data-theme="light"] body.tracking-dashboard .device-inspector.mobile-history-mode .device-inspector-icon{
    background:#e7f2ff!important;color:#087be3!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPeriodActions>button:not(.active),
  html[data-theme="light"] body.tracking-dashboard #historyPeriodActions #gxHistoryNetworkFilter,
  html[data-theme="light"] body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons>button:not(#historyPlayButton){
    background:#ffffff!important;color:#28425e!important;
    border-color:#bdcfe2!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPeriodActions #gxHistoryNetworkSelect{
    color:#28425e!important;background:transparent!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPeriodActions>button.active{
    background:#087df0!important;border-color:#087df0!important;color:#fff!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel #historyPlayback .history-playback-buttons #historyPlayButton{
    background:#087df0!important;border-color:#087df0!important;color:#fff!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel .gx-history-timeline-time{
    color:#38516e!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel #historyPositionList .gx-history-card-v01037{
    background:#fff!important;color:#1c3047!important;border-color:#c6d7e7!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel #historyPositionList .gx-history-card-v01037.active{
    background:#e3f1ff!important;color:#15385c!important;
    border-color:#078bfa!important;box-shadow:inset 0 0 0 1px #078bfa!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel .gx-history-card-coords-v01037{
    color:#526d85!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel .gx-history-origin-v01037{
    color:#365371!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel .gx-history-card-number-v01037{
    color:#345573!important;border-color:#b9cde0!important;background:#f4f9ff!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel .gx-history-card-v01037.active .gx-history-card-number-v01037{
    color:#fff!important;background:#078afc!important;border-color:#078afc!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel .gx-history-fence-v01037{
    background:#e4f6eb!important;color:#14663c!important;border-color:#95cdaa!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel .gx-history-fence-v01037.exit{
    background:#fff0ec!important;color:#af4633!important;border-color:#eab0a1!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel .gx-history-event-details-v01037{
    border-top-color:#c9d9e8!important;color:#28445e!important;
  }
  html[data-theme="light"] body.tracking-dashboard #historyPanel .gx-history-event-details-v01037 small{
    color:#607c95!important;
  }
}
