.tab-rail-shell {
  width: 100%;
}

.tab-rail-arrow {
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.tab-rail-arrow:hover:not(:disabled) {
  background: var(--bg-hover, rgba(255, 255, 255, 0.5));
}

[data-theme="dark"] .tab-rail-arrow {
  background: rgba(148, 163, 184, 0.18);
}

.nav-tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0 18px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  background: transparent;
}

.tab-button {
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  color: var(--text-secondary);
  position: relative;
  white-space: nowrap;
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  min-height: 38px;
  touch-action: manipulation;
}

.tab-button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.28);
  border-color: var(--border-color);
}

.tab-button.active {
  color: #4b6bfb;
  background: rgba(255, 255, 255, 0.36);
  border-color: rgba(75, 107, 251, 0.35);
  box-shadow: inset 0 0 0 1px rgba(75, 107, 251, 0.08);
}

[data-theme="dark"] .tab-button:hover {
  background: rgba(148, 163, 184, 0.16);
}

[data-theme="dark"] .tab-button.active {
  background: rgba(148, 163, 184, 0.2);
}

.tab-button::after {
  content: none;
}

@media (max-width: 900px) {
  .nav-tabs {
    gap: 6px;
    margin: 10px 0 14px;
    padding: 6px;
  }

  .tab-button {
    padding: 7px 11px;
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .tab-rail-shell {
    display: block;
    margin: 8px 0 12px;
  }

  .tab-rail-shell.is-overflowing {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    gap: 6px;
    align-items: center;
  }

  .tab-rail-shell.is-overflowing .tab-rail-arrow {
    display: inline-flex;
    width: 30px;
    height: 30px;
    transition: opacity 0.16s ease, background-color 0.16s ease;
  }

  .tab-rail-shell:not(.is-overflowing) .tab-rail-arrow {
    display: none;
  }

  .tab-rail-arrow:disabled {
    opacity: 0.4;
    pointer-events: none;
  }

  .nav-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, minmax(0, 1fr));
    grid-auto-columns: max-content;
    column-gap: 6px;
    row-gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    justify-content: flex-start;
    align-items: stretch;
    align-content: start;
    margin: 0;
    padding: 6px;
  }

  .tab-button {
    scroll-snap-align: start;
    min-height: 40px;
  }
}

@media (max-width: 480px) {
  .tab-rail-shell.is-overflowing {
    grid-template-columns: 26px minmax(0, 1fr) 26px;
    gap: 4px;
  }

  .tab-rail-shell.is-overflowing .tab-rail-arrow {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .nav-tabs {
    column-gap: 6px;
    row-gap: 5px;
    padding: 5px;
    border-radius: 12px;
  }

  .tab-button {
    font-size: 12px;
    padding: 7px 10px;
    min-height: 38px;
  }
}

.tab-content.card {
  box-shadow: none;
  border: none;
}

.tab-content.card.card--transparent {
  padding: 0;
  border-radius: 0;
}

.tab-content {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.tab-content.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}
