/* ==========================================================================
   View controls: sticky frosted bar, scrollable tab bar, segmented mode
   switch with sliding indicator. Sticky so long tables never lose the tabs.
   ========================================================================== */

.controls {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  background: rgba(7, 8, 11, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

@media (min-width: 1024px) {
  .controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) 0;
  }
}

.tabbar {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-1);
  padding: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  box-shadow: inset 0 1px 0 var(--surface-edge);
}

.tabbar::-webkit-scrollbar {
  display: none;
}

@media (min-width: 1024px) {
  .tabbar {
    flex: 1 1 auto;
    min-width: 0;
    margin-right: var(--space-3);
  }
}

.tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: var(--fs-small);
  font-weight: 550;
  line-height: 1.3;
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
  border-radius: var(--radius-control);
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
  transition:
    background-color var(--dur-standard) var(--ease-standard),
    border-color var(--dur-standard) var(--ease-standard),
    color var(--dur-standard) var(--ease-standard);
}

.tab:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.tab.is-active {
  background: linear-gradient(140deg, var(--accent-indigo), #4d57b8);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ------------------------------------------------------------ mode switch */

.modeswitch {
  position: relative;
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--surface-panel);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  box-shadow: inset 0 1px 0 var(--surface-edge);
  align-self: stretch;
}

@media (min-width: 1024px) {
  .modeswitch {
    align-self: auto;
    flex: 0 0 auto;
  }
}

.segment-indicator {
  position: absolute;
  top: var(--space-1);
  left: 0;
  height: calc(100% - var(--space-2));
  background: var(--surface-raise);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  transition: transform var(--dur-standard) var(--ease-standard);
  pointer-events: none;
}

.segment {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: var(--fs-small);
  font-weight: 550;
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
  flex: 1 1 auto;
  border-radius: var(--radius-control);
  cursor: pointer;
  position: relative;
  z-index: 1;
  white-space: nowrap;
  transition: color var(--dur-standard) var(--ease-standard);
}

@media (min-width: 640px) {
  .segment {
    flex: 0 0 auto;
  }
}

.segment:hover:not(.is-active) {
  color: var(--text-primary);
}

.segment.is-active {
  color: var(--text-primary);
  font-weight: 600;
}
