/* Mobile history follows the public main guide; desktop and data stay intact. */
@media (max-width: 768px) {
  body[data-page="history"] {
    --history-panel: #0a101c;
    --history-panel-strong: #101a27;
    --history-line: rgba(140,165,195,.16);
    --history-muted: #92a4b4;
    --history-blue: #79a9ff;
    --history-red: #ef554c;
    --history-green: #5fd3a4;
    --history-yellow: #e3bd7d;
    --history-orange: #e3bd7d;
    background: #0a101c;
    color: #c7cfd8;
    font-family: var(--sans);
  }
  body[data-page="history"] .ambient-grid { display: none; }
  body[data-page="history"] .app-shell { min-height: 100dvh; background: #0a101c; }
  body[data-page="history"] .topbar,
  body[data-page="history"] .mobile-app-status { background: #0a101c; box-shadow: none; border: 0; }
  body[data-page="history"] .mobile-language-control,
  body[data-page="history"] .mobile-more-trigger { color: #92a4b4; }
  body[data-page="history"] .mobile-bottom-nav { background: rgba(10,16,28,.97); box-shadow: none; }
  body[data-page="history"] .mobile-bottom-nav a { color: #92a4b4; }
  body[data-page="history"] .mobile-bottom-nav .is-active { color: #52c7b8; }
  body[data-page="history"] .mobile-bottom-nav svg { filter: none; }
  body[data-page="history"] .mobile-alert-count { background: #ef554c; color: #c7cfd8; box-shadow: none; }
  body[data-page="history"] .history-main { padding: 20px 0 32px; background: #0a101c; }
  body[data-page="history"] .history-card,
  body[data-page="history"] .history-fatal { background: #0a101c; border: 0; box-shadow: none; }
  body[data-page="history"] .history-card::before,
  body[data-page="history"] .history-card::after { content: none; }
  body[data-page="history"] .trend-card { display: flex; flex-direction: column; padding: 0 16px 24px; }
  body[data-page="history"] .trend-card__head { order: 0; gap: 8px; }
  body[data-page="history"] .trend-card__mobile-title { color: #c7cfd8; font: 650 24px/1.45 var(--sans); letter-spacing: -.02em; }
  body[data-page="history"] .trend-card__description { color: #92a4b4; font: 400 14px/1.7 var(--sans); overflow-wrap: anywhere; }
  body[data-page="history"] .trend-card__targets { margin-top: 8px; }
  body[data-page="history"] .trend-target-select { min-height: 44px; padding-right: 40px; background-position: right 14px center; border: 1px solid var(--history-line); border-radius: 6px; background-color: #101a27; color: #c7cfd8; font: 500 15px/1.4 var(--sans); }
  body[data-page="history"] .trend-target-select option { background: #101a27; color: #c7cfd8; }
  body[data-page="history"] .trend-plot { order: 1; height: 240px; margin: 18px 0 0; }
  body[data-page="history"] .trend-line { stroke: #79a9ff; stroke-width: 2.25; filter: none; }
  body[data-page="history"] .trend-area-stop--top { stop-color: #79a9ff; stop-opacity: .16; }
  body[data-page="history"] .trend-area-stop--bottom { stop-color: #79a9ff; stop-opacity: 0; }
  body[data-page="history"] .trend-grid line { stroke: rgba(140,165,195,.12); }
  body[data-page="history"] .trend-axis { stroke: rgba(140,165,195,.22); }
  body[data-page="history"] .trend-axis-label { fill: #6e8398; font-weight: 400; }
  body[data-page="history"] .trend-axis-title { fill: #6e8398; letter-spacing: 0; }
  body[data-page="history"] .trend-dot { fill: #0a101c; stroke: #79a9ff; }
  body[data-page="history"] .trend-dot--latest { fill: #52c7b8; stroke: #0a101c; }
  body[data-page="history"] .trend-latest-label { fill: #c7cfd8; font-weight: 600; }
  body[data-page="history"] .trend-stats { order: 2; grid-template-columns: 1fr 1fr 1.25fr; gap: 0; margin: 12px 0 0; }
  body[data-page="history"] .trend-stats > div { gap: 6px; padding: 0 8px; border: 0; border-radius: 0; background: transparent; text-align: center; }
  body[data-page="history"] .trend-stats > div + div { border-left: 1px solid var(--history-line); }
  body[data-page="history"] .trend-stats small { color: #92a4b4; font: 400 12px/1.5 var(--sans); letter-spacing: 0; }
  body[data-page="history"] .trend-stats strong { color: #c7cfd8; font: 600 17px/1.5 var(--sans); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
  body[data-page="history"] #trendLatest { color: #c7cfd8 !important; }
  body[data-page="history"] #trendChange[data-direction="up"] { color: #ef554c !important; }
  body[data-page="history"] #trendChange[data-direction="down"] { color: #5fd3a4 !important; }
  body[data-page="history"] #trendChange[data-direction="flat"],
  body[data-page="history"] #trendChange[data-direction="missing"] { color: #92a4b4 !important; }
  body[data-page="history"] #trendWindow { font: 400 11px/1.6 var(--mono); }
  body[data-page="history"] .trend-control--period { order: 3; margin: 22px 0 0; }
  body[data-page="history"] .trend-card__periods .period-switcher { justify-content: flex-start; gap: 4px; padding-bottom: 0; }
  body[data-page="history"] .trend-card__periods .period-button { flex: 1 0 auto; min-height: 44px; padding: 8px 10px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: #92a4b4; font: 500 13px/1.4 var(--sans); box-shadow: none; }
  body[data-page="history"] .trend-card__periods .period-button.active { border-bottom-color: #52c7b8; background: transparent; color: #52c7b8; box-shadow: none; }
  body[data-page="history"] .trend-turns { order: 4; margin-top: 24px; padding-top: 22px; border-color: var(--history-line); }
  body[data-page="history"] .trend-turns__head h3 { color: #52c7b8; font: 600 14px/1.5 var(--sans); }
  body[data-page="history"] .trend-turn-detail { margin-top: 14px; padding: 0; border: 0; background: transparent; }
  body[data-page="history"] .trend-turn-detail__date { margin-bottom: 12px; color: #92a4b4; font: 400 12px/1.5 var(--mono); letter-spacing: 0; }
  body[data-page="history"] .trend-turn-detail__items { gap: 20px; }
  body[data-page="history"] .trend-turn-detail__items strong { color: #c7cfd8; font: 500 16px/1.65 var(--sans); overflow-wrap: anywhere; }
  body[data-page="history"] .trend-turn-detail__source { color: #92a4b4; font: 400 13px/1.6 var(--sans); }
  body[data-page="history"] .trend-turn-detail__source a { color: #76b7ff; text-underline-offset: 3px; }
  body[data-page="history"] .trend-turn-guide { stroke: rgba(227,189,125,.35); }
  body[data-page="history"] .trend-turn-diamond { fill: #0a101c; }
  body[data-page="history"] .trend-turn-tooltip,
  body[data-page="history"] .trend-turn-tooltip[data-mode="compact"] { background: #101a27; border-color: var(--history-line); border-left-color: #e3bd7d; box-shadow: none; }
  body[data-page="history"] .trend-turn-tooltip__title,
  body[data-page="history"] .trend-turn-tooltip[data-mode="compact"] .trend-turn-tooltip__title { color: #c7cfd8; }
  body[data-page="history"] .trend-turn-tooltip__date { color: #92a4b4; }
  body[data-page="history"] .trend-zoom-reset { min-height: 44px; border-color: var(--history-line); background: #101a27; color: #c7cfd8; box-shadow: none; }
  body[data-page="history"] .trend-empty { border: 0; background: #0a101c; }
  body[data-page="history"] .trend-empty strong { color: #c7cfd8; }
  body[data-page="history"] .trend-empty p,
  body[data-page="history"] .trend-empty .trend-empty__known { color: #92a4b4; }
  body[data-page="history"] .history-notice { margin: 0 var(--mobile-app-gutter,20px) 16px; background: #101a27; border-color: var(--history-line); color: #c7cfd8; font: 400 14px/1.7 var(--sans); }
  body[data-page="history"] .history-fatal { padding: 24px var(--mobile-app-gutter,20px); }
  body[data-page="history"] .history-fatal h2 { color: #c7cfd8; font: 600 18px/1.6 var(--sans); }
  body[data-page="history"] .history-fatal button { min-height: 44px; background: #101a27; border-color: var(--history-line); color: #c7cfd8; }
  body[data-page="history"] .period-button:focus-visible,
  body[data-page="history"] .trend-target-select:focus-visible,
  body[data-page="history"] .trend-zoom-reset:focus-visible,
  body[data-page="history"] .trend-turn-detail__source a:focus-visible,
  body[data-page="history"] .history-fatal button:focus-visible { outline: 2px solid #76b7ff; outline-offset: 3px; }
  body[data-page="history"] .trend-turns__count { color: #6e8398; font-weight: 400; }
  body[data-page="history"] .trend-turn-detail__source a { display: inline-flex; align-items: center; min-height: 44px; }
  body[data-page="history"] .trend-turns__none { color: #92a4b4; font: 400 14px/1.7 var(--sans); }
  body[data-page="history"] .trend-turn-marker:hover .trend-turn-hit,
  body[data-page="history"] .trend-turn-marker:focus-visible .trend-turn-hit { fill: rgba(227,189,125,.09); }
  body[data-page="history"] .trend-turn-marker:hover .trend-turn-guide,
  body[data-page="history"] .trend-turn-marker:focus-visible .trend-turn-guide { stroke: rgba(227,189,125,.65); }
  body[data-page="history"] .mobile-more-sheet__panel { background: #101a27; }
  body[data-page="history"] .mobile-more-sheet__close { background: transparent; }
}
