/* ============================================================
   HISTORY / TRACKING SCREEN
   ============================================================ */

.history-inner {
  /* sidebar is position:fixed — screen-inner's 720px centering applies */
}

/* ---- Sidebar ---- */
.history-sidebar {
  position: fixed;
  top: 50%;
  right: max(var(--space-sm), calc(25% - 263px));
  width: 190px;
  max-height: 90svh;
  overflow-y: auto;
  z-index: 10;
  transform: translateY(-50%) translateX(calc(100% + 40px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease-in, opacity 0.2s ease-in;
}

.history-sidebar.visible {
  transform: translateY(-50%) translateX(0);
  opacity: 1;
  pointer-events: auto;
  transition: transform 0.25s ease-out 0.15s, opacity 0.2s ease 0.15s;
}

.history-sidebar .filter-chip-label {
  text-align: center;
}

.history-sidebar .history-filter-wrap {
  margin-bottom: 0;
}

.history-sidebar .history-filter-row {
  flex-direction: column;
  gap: var(--space-md);
}

.history-sidebar .filter-row-sep {
  width: 100%;
  height: 1px;
}

/* Label above, buttons fill full width */
.history-sidebar .filter-chip-group {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-xs);
}

.history-sidebar .filter-chip-btns {
  display: flex;
  gap: 3px;
}

.history-sidebar .filter-chip-btns .filter-chip {
  flex: 1;
  text-align: center;
}

.history-sidebar .session-limit-btns {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}

.history-sidebar .session-limit-btn {
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}

.history-sidebar .filter-input--inline,
.history-sidebar .filter-input {
  width: 100%;
  box-sizing: border-box;
}

.history-sidebar .specific-filter-bottom {
  flex-direction: column;
  align-items: stretch;
}

/* ---- Main content ---- */
.history-main {
  min-width: 0;
}

/* ---- Header (Find Gaps centred, actions pinned right) ---- */
.history-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: var(--space-xl);
}

.history-header-actions {
  position: absolute;
  right: 0;
  display: flex;
  gap: var(--space-xs);
}

/* ---- Session limit buttons ---- */
.session-limit-btns {
  display: flex;
  gap: 3px;
}

.session-limit-btn {
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

@media (hover: hover) {
  .session-limit-btn:hover {
    color: var(--text-secondary);
    border-color: var(--border-medium);
    background: var(--bg-elevated);
  }
}

.session-limit-btn.selected {
  background: hsla(265, 50%, 40%, 0.15);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 0 6px hsla(265, 90%, 65%, 0.12);
}

.btn-danger {
  background: var(--error);
  color: white;
  padding: var(--space-md) var(--space-xl);
  font-size: 1rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow-error);
  flex: 1;
}

@media (hover: hover) {
  .btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px hsla(0, 80%, 60%, 0.45);
  }
}

.btn-danger:active {
  transform: translateY(0);
}

.clear-confirm-card {
  max-width: 380px;
}

.clear-confirm-msg {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  line-height: 1.6;
}

.btn-danger-ghost {
  color: var(--error) !important;
}

@media (hover: hover) {
  .btn-danger-ghost:hover {
    background: hsla(0, 80%, 60%, 0.12) !important;
  }
}

/* ---- Compact filter row ---- */
.history-filter-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  margin-bottom: var(--space-lg);
  overflow: hidden;
}

.history-filter-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  padding: var(--space-sm) var(--space-md);
}

.filter-chip-group {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.filter-chip-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  white-space: nowrap;
}

.filter-chip-btns {
  display: flex;
  gap: 3px;
}

.filter-chip {
  padding: 4px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  font-family: inherit;
}

@media (hover: hover) {
  .filter-chip:hover {
    color: var(--text-secondary);
    border-color: var(--border-medium);
    background: var(--bg-elevated);
  }
}

.filter-chip.selected {
  background: hsla(265, 50%, 40%, 0.15);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 0 6px hsla(265, 90%, 65%, 0.12);
}

.filter-row-sep {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

/* ---- Value filter slide-out panel ---- */
.filter-value-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}

.filter-value-panel.open {
  grid-template-rows: 1fr;
}

.filter-value-panel-inner {
  overflow: hidden;
}

.filter-sub-panel {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

.filter-sub-panel--tags {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-xs);
}

.specific-filter-suggestions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.specific-filter-suggestions:empty {
  display: none;
}

.suggest-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  white-space: nowrap;
}

.suggest-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px 2px 9px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

@media (hover: hover) {
  .suggest-chip:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: hsla(265, 50%, 40%, 0.1);
  }
}

.suggest-chip.added {
  opacity: 0.35;
  pointer-events: none;
}

.suggest-plus {
  color: var(--accent-secondary);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.specific-filter-bottom {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.specific-filter-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
  min-width: 0;
}

.specific-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.specific-val-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px 2px 10px;
  background: hsla(265, 50%, 40%, 0.15);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.specific-val-chip-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
  border-radius: 3px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

@media (hover: hover) {
  .specific-val-chip-x:hover {
    color: var(--error);
    background: hsla(0, 80%, 60%, 0.1);
  }
}

.filter-input--inline {
  width: 120px;
  flex-shrink: 0;
}

.filter-value-panel.mode-specific #filter-specific-panel,
.filter-value-panel.mode-range    #filter-range-panel {
  display: flex;
}

.filter-sub-hint {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  flex: 1;
}

.filter-range-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Kept for value panel inputs */
.filter-input-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.filter-input {
  width: 90px;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* ---- Stats overview ---- */
.history-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px var(--space-sm);
  text-align: center;
}

.stat-card .stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-top: var(--space-xs);
}

/* ---- Charts card (wraps compare bar + charts + legend) ---- */
.history-chart-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

/* ---- Compare bar (inside card) ---- */
.history-compare-bar {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.compare-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 600;
  white-space: nowrap;
}

.compare-btn {
  padding: 4px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

@media (hover: hover) {
  .compare-btn:hover:not(:disabled) {
    color: var(--text-secondary);
    border-color: var(--border-medium);
    background: var(--bg-elevated);
  }
}

.compare-btn.active {
  background: hsla(265, 50%, 40%, 0.15);
  border-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 0 6px hsla(265, 90%, 65%, 0.12);
}

.compare-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---- Chart legend (inside card, below charts) ---- */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 5px 12px 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

@media (hover: hover) {
  .legend-item:hover,
  .legend-item.highlighted {
    background: var(--bg-elevated);
    border-color: var(--border-medium);
  }
}

.legend-swatch {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.legend-item.highlighted .legend-label {
  color: var(--text-primary);
}

/* ---- Charts row (inside card) ---- */
.history-charts-row {
  display: flex;
  gap: 0;
  margin-bottom: 0;
}

.history-chart-area {
  flex: 1;
  min-width: 0;
  padding-right: var(--space-lg);
}

.history-chart-area--right {
  padding-right: 0;
  padding-left: var(--space-lg);
  border-left: 1px solid var(--border-subtle);
}

.history-chart-area h3 {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: 0.95rem;
}

.chart-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0;
}

.history-chart-area canvas {
  width: 100% !important;
  height: auto !important;
}

@media (max-width: 560px) {
  .history-charts-row {
    flex-direction: column;
  }
  .history-chart-area--right {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    padding-left: 0;
    padding-top: var(--space-lg);
    margin-top: var(--space-lg);
  }

  .history-op-breakdown {
    flex-direction: column;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    gap: var(--space-md);
  }
  .op-breakdown-col {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
  }
  .op-breakdown-col--right {
    border-left: 1px solid var(--border-subtle);
    padding-left: var(--space-lg);
  }
}

/* ---- Op accuracy / speed bars ---- */
.history-op-breakdown {
  display: flex;
  gap: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.op-breakdown-col {
  flex: 1;
  min-width: 0;
  padding-right: var(--space-lg);
}

.op-breakdown-col--right {
  padding-right: 0;
  padding-left: var(--space-lg);
  border-left: 1px solid var(--border-subtle);
}

.op-breakdown-col h3 {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: 0.95rem;
}

.op-accuracy-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.op-acc-row {
  display: grid;
  grid-template-columns: 80px 1fr 60px;
  align-items: center;
  gap: var(--space-md);
}

.op-acc-row .op-acc-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.op-acc-bar-bg {
  height: 10px;
  background: var(--bg-tertiary);
  border-radius: 5px;
  overflow: hidden;
}

.op-acc-bar-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--accent-gradient);
  transition: width 0.6s ease;
}

.op-speed-bar-fill {
  height: 100%;
  border-radius: 5px;
  background: #22d3ee;
  transition: width 0.6s ease;
}

.op-acc-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

/* ---- Session list ---- */
.history-sessions h3 {
  margin-bottom: var(--space-md);
  font-size: 0.95rem;
}

.history-session-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.session-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

@media (hover: hover) {
  .session-card:hover {
    border-color: var(--border-medium);
    background: var(--bg-elevated);
  }
}

.session-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.session-card-mode {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary-dim);
  color: var(--accent-primary);
}

.session-card-mode.btc {
  background: var(--accent-secondary-dim);
  color: var(--accent-secondary);
}

.session-card-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.session-card-stats {
  display: flex;
  gap: var(--space-lg);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.session-card-stats span {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text-primary);
}

.session-card-details {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  display: none;
}

.session-card.expanded .session-card-details {
  display: block;
}

.session-detail-questions {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-dq {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 3px;
  display: flex;
  justify-content: space-between;
}

.session-dq.correct {
  color: var(--success);
  background: hsla(145, 70%, 50%, 0.06);
}

.session-dq.incorrect {
  color: var(--error);
  background: hsla(0, 80%, 60%, 0.06);
}

.session-dq-ca {
  color: var(--success);
}

.history-empty {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  padding: var(--space-2xl);
}

/* ---- View Report button (top-left) ---- */
.history-header-actions-left {
  position: absolute;
  left: 0;
}

.btn-view-report {
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---- Find My Gaps button ---- */
.btn-find-gaps {
  font-weight: 600;
}

/* ---- Find My Gaps popup ---- */
.gaps-popup {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: gapsFadeIn 0.25s ease;
}

@keyframes gapsFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gaps-popup-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-2xl) var(--space-xl);
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: gapsSlideUp 0.3s ease;
}

@keyframes gapsSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.gaps-close-btn {
  position: absolute;
  top: 28px;
  right: var(--space-xl);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
@media (hover: hover) {
  .gaps-close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
  }
}

.gaps-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.2rem;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
  padding-right: 32px;
}
.gaps-title svg {
  color: var(--accent-primary);
}

.gaps-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  min-height: 200px; /* reserves space for 3 gap steps so tab switch doesn't resize popup */
}

.gaps-no-data {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.9rem;
  padding: var(--space-lg);
}

/* Each gap step */
.gap-step {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.gap-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.gap-step-body {
  flex: 1;
  min-width: 0;
}

.gap-step-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.gap-step-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
}

.gap-step-detail {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.gap-step-value .gap-acc {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--error);
  margin-left: var(--space-sm);
}

.gap-values-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.gap-val-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.gap-val-chip .gap-acc {
  color: var(--error);
  font-size: 0.75rem;
  margin-left: 4px;
}

.gaps-scope-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.gaps-scope-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.gaps-toggle-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 90px;
}

.gaps-toggle-btns {
  display: flex;
  gap: var(--space-xs);
  flex: 1;
}

.gaps-toggle-btn {
  flex: 1;
  padding: var(--space-xs) var(--space-sm);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  text-align: center;
  white-space: nowrap;
}

.gaps-toggle-btn.active {
  background: var(--accent-primary-dim);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

@media (hover: hover) {
  .gaps-toggle-btn:hover:not(.active) {
    background: var(--bg-elevated);
    color: var(--text-primary);
  }
}

.launch-input-toggle {
  /* No flex override, allow default stretching */
}

.launch-input-toggle .gaps-toggle-btn {
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gaps-action-row {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
}

.gaps-start-btn {
  min-width: 250px; /* wide enough for icon + "Start Beat the Clock" */
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 1.0rem;
  font-weight: 700;
  padding: var(--space-md) var(--space-lg);
}

.gaps-cancel-btn {
  flex: 1;
}

/* ---- Mode tab toggle (Accuracy / Speed) ---- */
.gaps-mode-tabs {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: var(--space-lg);
  gap: 3px;
}

.gaps-mode-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 12px;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  text-align: center;
}

.gaps-mode-tab.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px hsla(265, 80%, 60%, 0.25);
}

@media (hover: hover) {
  .gaps-mode-tab:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-elevated);
  }
}

/* ---- Session config panel ---- */
.gaps-session-config {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.gaps-session-config--inline {
  flex-direction: row;
  align-items: center;
  gap: var(--space-md);
}

.gaps-session-config--inline .gaps-config-row {
  flex: 1;
}

/* ---- Spinner field (text input + stacked up/down arrows) ---- */
.gaps-spinner-field {
  display: flex;
  align-items: stretch;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.gaps-spinner-field:focus-within {
  border-color: var(--accent-primary);
}

.gaps-spinner-input {
  width: 44px;
  padding: 4px 6px;
  background: transparent;
  border: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.gaps-spinner-input::-webkit-outer-spin-button,
.gaps-spinner-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.gaps-spinner-arrows {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-subtle);
}

.gaps-spinner-arrow {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: background var(--transition-fast), color var(--transition-fast);
  font-family: inherit;
}

@media (hover: hover) {
  .gaps-spinner-arrow:hover {
    background: var(--accent-primary-dim);
    color: var(--text-primary);
  }
}

.gaps-spinner-arrow + .gaps-spinner-arrow {
  border-top: 1px solid var(--border-subtle);
}

.gaps-config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
}

.gaps-config-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.gaps-mini-stepper {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.gaps-stepper-btn {
  width: 30px;
  height: 30px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-family: inherit;
  line-height: 1;
}

@media (hover: hover) {
  .gaps-stepper-btn:hover {
    background: var(--accent-primary-dim);
    border-color: var(--accent-primary);
    color: var(--text-primary);
  }
}

.gaps-stepper-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  min-width: 36px;
  text-align: center;
  color: var(--text-primary);
}

.gaps-diff-btns {
  display: flex;
  gap: var(--space-xs);
}

.gaps-diff-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  font-family: inherit;
}

@media (hover: hover) {
  .gaps-diff-btn:hover:not(.active) {
    background: var(--bg-elevated);
    color: var(--text-primary);
  }
}

.gaps-diff-btn.active {
  background: var(--accent-primary-dim);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* ---- Performance Report popup ---- */
.report-popup-card {
  max-width: 780px;
  width: 95vw;
  padding-top: var(--space-md);
}

.report-popup-card .gaps-title {
  margin-bottom: var(--space-xs);
  font-size: 1rem;
}

#report-popup {
  overflow-y: auto;
  align-items: flex-start;
  padding: var(--space-lg) 0 var(--space-2xl);
}

.report-view-tabs {
  margin-bottom: var(--space-md);
}

.report-session-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}

.report-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-bottom: var(--space-sm);
}

/* Stat badges */
.rstat {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.rstat-good  { color: var(--success); background: hsla(145, 70%, 50%, 0.12); }
.rstat-ok    { color: var(--warning); background: hsla(40, 90%, 60%, 0.12); }
.rstat-bad   { color: var(--error);   background: hsla(0, 80%, 60%, 0.12); }
.rstat-time  { color: var(--accent-secondary); background: hsla(190, 90%, 55%, 0.1); }
.rstat-count { color: var(--text-tertiary); background: var(--bg-tertiary); }

/* Cards grid */
.report-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-sm);
}

.report-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: default;
}

.report-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

@media (hover: hover) {
  .report-card-header:hover,
  .report-card-header.hdr-selected {
    background: var(--bg-elevated);
  }
}

.report-card-center-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  text-align: center;
}

.report-card-symbol {
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-primary);
  line-height: 1.1;
}

.report-dir-sym {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.report-card-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.report-card-qcount {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.rstat-hdr {
  font-size: 1rem;
  padding: 4px 8px;
  min-width: 52px;
  text-align: center;
}

.rstat-hdr-placeholder {
  min-width: 52px;
}

/* Sub-toggle (Direction / Value) */
.report-sub-toggle {
  display: flex;
  gap: 1px;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.report-sub-btn {
  flex: 1;
  padding: 5px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.report-sub-btn.active {
  background: var(--accent-primary-dim);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

/* Sub-panel content — both panels stack in the same grid cell so the card
   height is always set by the taller panel (the scatter plot) and never
   changes when the user switches between Direction and Value. */
.report-sub-content {
  display: grid;
}

.report-sub-panel {
  grid-area: 1 / 1;
  visibility: hidden;
  pointer-events: none;
  min-width: 0;
}

.report-sub-panel.active {
  visibility: visible;
  pointer-events: auto;
}

/* Table header + rows */
.report-table-header {
  display: grid;
  grid-template-columns: 1fr 48px 46px 36px;
  gap: 4px;
  padding: 8px var(--space-md);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}

.report-table-header span:not(:first-child) {
  text-align: center;
}

.report-dir-row span:not(:first-child) {
  justify-self: center;
}

.report-dir-row {
  display: grid;
  grid-template-columns: 1fr 48px 46px 36px;
  gap: 4px;
  align-items: center;
  padding: 9px var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.report-dir-row:last-child {
  border-bottom: none;
}

@media (hover: hover) {
  .report-dir-row:hover {
    background: var(--bg-tertiary);
  }
}

.report-dir-row.selected {
  background: hsla(265, 90%, 65%, 0.08);
  border-left: 2px solid var(--accent-primary);
}

.report-dir-name {
  font-size: 0.95rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.report-dir-opsym {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--accent-primary);
  font-size: 0.9rem;
  margin-right: 2px;
}

.report-weak-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: var(--warning);
  color: #000;
  border-radius: 50%;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

/* Practice bar at bottom of card */
.report-card-practice {
  padding: var(--space-xs) var(--space-md);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
}

.report-practice-btn {
  width: 100%;
  padding: 6px var(--space-sm);
  background: var(--accent-primary-dim);
  border: 1px solid var(--accent-primary);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

@media (hover: hover) {
  .report-practice-btn:hover {
    background: var(--accent-primary);
    color: white;
  }
}

/* Scatter plot */
.scatter-wrap {
  padding: var(--space-sm);
}

.scatter-plot {
  position: relative;
  width: 100%;
  padding-bottom: 47%;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(to right, hsla(0,70%,50%,0.04) 50%, hsla(145,70%,50%,0.04) 50%),
    linear-gradient(to bottom, transparent 50%, hsla(0,70%,50%,0.04) 50%);
  overflow: visible;
}

.scatter-ql {
  position: absolute;
  font-size: 0.58rem;
  color: var(--text-tertiary);
  line-height: 1.3;
  pointer-events: none;
  opacity: 0.7;
}

.sq-tl { top: 4px; left: 5px; }
.sq-tr { top: 4px; right: 5px; text-align: right; }
.sq-bl { bottom: 16px; left: 5px; }
.sq-br { bottom: 16px; right: 5px; text-align: right; }

.scatter-ax-x-mid {
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-tertiary);
  pointer-events: none;
  white-space: nowrap;
}

.scatter-ax-y-mid {
  position: absolute;
  top: 50%;
  left: 0; /* overridden by JS */
  transform: translateY(-50%) rotate(-90deg);
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-tertiary);
  pointer-events: none;
  white-space: nowrap;
}

.scatter-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition:
    width var(--transition-fast),
    height var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
  z-index: 2;
  user-select: none;
  border: 2px solid transparent;
}

.scatter-dot::after {
  content: attr(data-val);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.sdot-good {
  background: hsla(145, 70%, 50%, 0.2);
  color: var(--success);
  border-color: hsla(145, 70%, 50%, 0.4);
}

.sdot-ok {
  background: hsla(40, 90%, 60%, 0.2);
  color: var(--warning);
  border-color: hsla(40, 90%, 60%, 0.4);
}

.sdot-bad {
  background: hsla(0, 80%, 60%, 0.2);
  color: var(--error);
  border-color: hsla(0, 80%, 60%, 0.4);
}

@media (hover: hover) {
  .scatter-dot:hover {
    width: 28px;
    height: 28px;
    transform: translate(-50%, -50%);
    z-index: 10;
  }

  .scatter-dot:hover::after {
    opacity: 1;
  }
}

.scatter-dot.selected {
  width: 28px;
  height: 28px;
  box-shadow: 0 0 0 3px var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translate(-50%, -50%);
  z-index: 5;
}

.scatter-dot.selected::after {
  opacity: 1;
}

.scatter-tooltip {
  display: none;
  position: absolute;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.scatter-sel-bar {
  margin-top: 4px;
  min-height: 20px;
  display: flex;
  align-items: center;
}

.scatter-sel-hint {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-style: italic;
}

.report-val-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: var(--space-sm) var(--space-md);
}

.report-val-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: default;
  display: flex;
  gap: 4px;
  align-items: center;
}

.rvc-acc {
  font-size: 0.68rem;
}

.report-no-data-small {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-style: italic;
  padding: var(--space-xs) var(--space-md);
}

/* Suggestions section */

/* On touch devices: FAB is reparented into the selected card */
@media (pointer: coarse) {
  .report-card {
    position: relative;
    overflow: visible;
  }
  .report-card-header {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
  .report-train-fab.fab--in-card {
    position: absolute;
    top: 50%;
    left: 50%;
  }
}

/* Floating Train FAB */
.report-train-fab {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: none;
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  z-index: 210;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding-top: 8px;
  box-shadow: 0 0 40px hsla(265, 90%, 65%, 0.45), var(--shadow-lg);
  transition:
    transform 420ms cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 220ms ease,
    box-shadow 200ms ease;
}

.report-train-fab.visible {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

@media (hover: hover) {
  .report-train-fab.visible:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 55px hsla(265, 90%, 65%, 0.6), var(--shadow-lg);
  }
}

.report-train-fab.visible:active {
  transform: translate(-50%, -50%) scale(0.95);
}

@keyframes trainFabBounce {
  0%   { transform: translate(-50%, -50%) scale(1); }
  35%  { transform: translate(-50%, -50%) scale(1.1); }
  70%  { transform: translate(-50%, -50%) scale(0.97); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.report-train-fab.bouncing {
  animation: trainFabBounce 420ms ease-in-out;
}

@keyframes trainFabGlow {
  0%   { box-shadow: 0 0 40px hsla(265, 90%, 65%, 0.45), var(--shadow-lg); }
  50%  { box-shadow: 0 0 52px 8px hsla(265, 90%, 65%, 0.58), 0 0 68px hsla(190, 90%, 55%, 0.32), var(--shadow-lg); }
  100% { box-shadow: 0 0 40px hsla(265, 90%, 65%, 0.45), var(--shadow-lg); }
}

.report-train-fab.shimmering {
  animation: trainFabGlow 350ms ease-in-out;
}

.fab-train-label {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
}

.fab-train-op {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

/* Practice modal */
.report-practice-card {
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}

.rp-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--accent-secondary);
  margin-bottom: var(--space-md);
  font-weight: 600;
}

/* ---- Plug Gaps confirm popup — scrollable card ---- */
.plug-gaps-confirm-card {
  max-height: 90vh;
  overflow-y: auto;
}

/* ---- Plug Gaps question list ---- */
.plug-question-list {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  margin-bottom: var(--space-md);
  height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}

.plug-question-list::-webkit-scrollbar {
  width: 4px;
}

.plug-question-list::-webkit-scrollbar-track {
  background: transparent;
}

.plug-question-list::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

.plug-question-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.plug-q-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: var(--space-xs) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-tertiary);
}

.plug-q-list {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.plug-q-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 5px var(--space-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border-subtle);
}

.plug-q-item:last-child {
  border-bottom: none;
}

.plug-q-expr {
  font-weight: 600;
  color: var(--text-primary);
}

.plug-q-ua {
  font-weight: 700;
  color: var(--error);
}

.plug-q-ca {
  color: var(--success);
  font-weight: 600;
  margin-left: auto;
}

.plug-q-time {
  color: var(--accent-secondary);
  font-weight: 700;
  margin-left: auto;
}

.plug-q-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.plug-q-perfect {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  color: var(--success);
}

/* ---- Accuracy tab: no-errors (perfect session) state ---- */
.gaps-mode-tab.no-errors {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.gaps-mode-tab.no-errors svg {
  color: var(--success);
  vertical-align: middle;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */


@media (max-width: 700px) {
  .filter-chip {
    padding: 3px 7px;
    font-size: 0.75rem;
  }

  .op-acc-row {
    grid-template-columns: 60px 1fr 50px;
  }
}

@media (max-width: 600px) {
  /* Keep all 4 stat cards on one row with tighter sizing */
  .history-stats {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xs);
  }
  .stat-card {
    padding: 8px var(--space-xs);
  }
  .stat-card .stat-value {
    font-size: 1.2rem;
  }
  .stat-card .stat-label {
    font-size: 0.65rem;
  }
}

@media (max-width: 768px) {
  /* Show filter button in header; hide the sidebar's own protruding toggle tab */
  #btn-filter-sidebar {
    display: inline-flex !important;
  }
  .sidebar-toggle-btn {
    display: none !important;
  }

  .history-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    height: 100vh;
    height: 100svh;
    max-height: 100vh;
    max-height: 100svh;
    width: 260px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-medium);
    padding: var(--space-md);
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
    z-index: 150;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  }

  .history-sidebar.visible {
    transform: translateX(100%);
    opacity: 1;
    pointer-events: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  }

  .history-sidebar.mobile-open {
    transform: translateX(0) !important;
  }

  .sidebar-toggle-btn {
    display: flex !important;
    position: absolute;
    left: -42px;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.15);
    transition: color var(--transition-fast), background var(--transition-fast);
  }

  .sidebar-toggle-btn:active {
    background: var(--bg-elevated);
  }
}

@media (max-width: 600px) {
  .btn-view-report span,
  #btn-clear-data span,
  #btn-filter-sidebar .btn-filter-label {
    display: none;
  }

  .btn-view-report,
  #btn-clear-data,
  #btn-filter-sidebar {
    padding: 0;
    min-width: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
