.page-tool--csv-viewer .tool-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.page-tool--csv-viewer .tool-workspace {
    display: grid;
    grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.page-tool--csv-viewer .tool-input-pane,
.page-tool--csv-viewer .tool-viewer-pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.page-tool--csv-viewer .tool-input-pane__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.page-tool--csv-viewer .tool-input-pane__textarea {
    min-height: 13rem;
}

.page-tool--csv-viewer .tool-input-pane__file {
    min-height: 42px;
    padding: 0.4rem 0.55rem;
    font-size: 0.82rem;
}

.page-tool--csv-viewer .tool-options {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}

.page-tool--csv-viewer .tool-options .field {
    flex: 0 0 auto;
}

.page-tool--csv-viewer .tool-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding-bottom: 9px;
    color: var(--ink-2);
    font-size: 0.84rem;
    cursor: pointer;
}

.page-tool--csv-viewer .tool-check input {
    accent-color: var(--accent);
}

.page-tool--csv-viewer .tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.page-tool--csv-viewer .tool-hint {
    min-height: 1.1em;
    margin: 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.page-tool--csv-viewer .tool-viewer-pane__body {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.page-tool--csv-viewer .tool-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.page-tool--csv-viewer .tool-toolbar__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1 1 260px;
    min-width: 0;
}

.page-tool--csv-viewer .tool-search {
    flex: 1 1 200px;
    min-width: 0;
    min-height: 40px;
    background: var(--surface);
}

.page-tool--csv-viewer .tool-search .search__input {
    font-size: 0.88rem;
}

.page-tool--csv-viewer .tool-filter-column {
    flex: 0 0 auto;
    max-width: 12rem;
}

.page-tool--csv-viewer .tool-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.page-tool--csv-viewer .tool-status {
    min-height: 0;
    margin: 0;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--muted);
}

.page-tool--csv-viewer .tool-status.status {
    margin: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
}

.page-tool--csv-viewer .tool-status.status--success {
    background: var(--success-soft);
    color: var(--success);
}

.page-tool--csv-viewer .tool-status.status--error {
    background: var(--danger-soft);
    color: var(--danger);
}

.page-tool--csv-viewer .tool-status.status--warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.page-tool--csv-viewer .tool-table-scroll {
    flex: 1 1 auto;
    min-height: 20rem;
    max-height: 34rem;
    overflow: auto;
    background: var(--surface);
}

.page-tool--csv-viewer .tool-table-scroll .empty-state {
    min-height: 20rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    justify-content: center;
}

.page-tool--csv-viewer .tool-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.page-tool--csv-viewer .tool-table__head {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 0;
    border-bottom: 1px solid var(--line-2);
    background: var(--surface-3);
    text-align: left;
    white-space: nowrap;
}

.page-tool--csv-viewer .tool-table__sort {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 9px 14px;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    font: inherit;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: left;
    cursor: pointer;
}

.page-tool--csv-viewer .tool-table__sort:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.page-tool--csv-viewer .tool-table__sort:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.page-tool--csv-viewer .tool-table__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-tool--csv-viewer .tool-table__arrow {
    margin-left: auto;
    color: var(--faint);
    font-size: 0.72rem;
}

.page-tool--csv-viewer .tool-table__head[aria-sort="ascending"] .tool-table__sort,
.page-tool--csv-viewer .tool-table__head[aria-sort="descending"] .tool-table__sort {
    color: var(--accent);
}

.page-tool--csv-viewer .tool-table__head[aria-sort="ascending"] .tool-table__arrow,
.page-tool--csv-viewer .tool-table__head[aria-sort="descending"] .tool-table__arrow {
    color: var(--accent);
}

.page-tool--csv-viewer .tool-table__cell {
    max-width: 26rem;
    padding: 7px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-tool--csv-viewer .tool-table__cell--num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.page-tool--csv-viewer .tool-table tbody tr:nth-child(even) {
    background: var(--surface-2);
}

.page-tool--csv-viewer .tool-table tbody tr:hover {
    background: var(--accent-soft);
}

.page-tool--csv-viewer .tool-results-note {
    margin: 0;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.76rem;
}

.page-tool--csv-viewer .tool-about__text {
    max-width: 80ch;
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 880px) {
    .page-tool--csv-viewer .tool-workspace {
        grid-template-columns: 1fr;
    }

    .page-tool--csv-viewer .tool-input-pane__textarea {
        min-height: 10rem;
    }

    .page-tool--csv-viewer .tool-table-scroll {
        max-height: 26rem;
    }
}

@media (max-width: 560px) {
    .page-tool--csv-viewer .tool-toolbar {
        align-items: stretch;
    }

    .page-tool--csv-viewer .tool-toolbar__actions {
        flex: 1 1 100%;
    }

    .page-tool--csv-viewer .tool-filter-column {
        max-width: none;
        flex: 1 1 100%;
    }
}
