.fs-spreadsheet {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--fs-color-surface);
  border: 1px solid var(--fs-color-border);
  border-radius: var(--fs-radius-lg);
  box-shadow: var(--fs-shadow-sm);
}

.fs-spreadsheet__viewport {
  width: 100%;
  max-width: 100%;
  max-height: min(76vh, 900px);
  overflow: auto;
  background: var(--fs-color-surface);
  overscroll-behavior: contain;
}

.fs-spreadsheet__toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 46px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--fs-color-border-subtle);
  background: var(--fs-color-surface-subtle);
}

.fs-spreadsheet__toolbar > span,
.fs-spreadsheet__zoom-label {
  color: var(--fs-color-text-secondary);
  font-size: 11px;
}

.fs-spreadsheet__zoom-label {
  min-width: 42px;
  text-align: center;
}

.fs-spreadsheet__zoom-target {
  display: block;
  width: fit-content;
}

.fs-spreadsheet__table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.fs-spreadsheet__table th,
.fs-spreadsheet__table td {
  min-width: 112px;
  max-width: 240px;
  padding: 9px 10px;
  overflow: hidden;
  border-right: 1px solid var(--fs-color-border-subtle);
  border-bottom: 1px solid var(--fs-color-border-subtle);
  background: var(--fs-color-surface);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fs-spreadsheet__table.is-sheet {
  min-width: 0;
  table-layout: fixed;
}

.fs-spreadsheet__table.is-sheet td {
  box-sizing: border-box;
  min-width: 0;
  max-width: none;
  overflow: visible;
  padding: 3px 5px;
  text-overflow: clip;
  white-space: pre-wrap;
}

.fs-spreadsheet__table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  background: var(--fs-color-surface-subtle);
  color: var(--fs-color-primary-hover);
  font-size: var(--fs-text-xs);
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.fs-spreadsheet__table.is-table tbody tr:hover td,
.fs-spreadsheet__table.is-table tbody tr:hover th {
  background: var(--fs-color-surface-hover);
}

.fs-spreadsheet__table.is-table .is-number {
  font-variant-numeric: tabular-nums;
  text-align: right !important;
}

.fs-spreadsheet__table .is-date,
.fs-spreadsheet__table .is-boolean {
  font-variant-numeric: tabular-nums;
}

.fs-spreadsheet__table .is-error {
  color: var(--fs-color-danger);
  font-weight: 600;
}

.fs-spreadsheet__table .is-blank {
  color: var(--fs-color-text-secondary);
}

.fs-spreadsheet__pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fs-spreadsheet__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--fs-color-text-secondary);
  font-size: 11px;
}

.fs-spreadsheet__pagination > span {
  min-width: 48px;
  text-align: center;
}

@media (max-width: 760px) {
  .fs-spreadsheet__viewport {
    max-height: 70vh;
  }

  .fs-spreadsheet__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .fs-spreadsheet__pagination {
    justify-content: space-between;
  }
}
