/**
 * Dedicated Table Page Styles
 *
 * Full-page layout for the filings table view with filter sidebar.
 */

/* =============================================
   Page Layout
   ============================================= */

/* Fills whatever .page-content has left inside the page shell, which is the
 * viewport minus the header, any site banners and the disclaimer (CCT-322).
 * This replaced `min-height: calc(100vh - 52px)`, which counted the header as
 * the only chrome and so pushed the page past the fold whenever a banner was
 * showing. flex-basis stays auto, so a long result set still grows the page
 * and scrolls it as before. */
.table-page {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* =============================================
   Search Bar
   ============================================= */

.table-search-bar {
    background: var(--header-bg);
    backdrop-filter: saturate(120%) blur(16px);
    -webkit-backdrop-filter: saturate(120%) blur(16px);
    padding: 16px 24px;
    border-bottom: none;
}

.table-search-form {
    display: flex;
    gap: 12px;
    max-width: 800px;
    margin: 0 auto;
}

.table-search-input-wrapper {
    flex: 1;
    position: relative;
}

.table-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.table-search-input {
    width: 100%;
    padding: 12px 12px 12px 44px;
    font-size: 16px;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    background: var(--gray-50);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.table-search-input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--ocean-tint-strong);
}

.table-search-input::placeholder {
    color: var(--text-secondary);
}

.table-search-btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 10px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

/* Pin the button's box so swapping "Search" -> spinner + "Searching…" mid-search
 * can't move anything.
 *   min-width: the pending content measures ~153px; 160px keeps headroom for
 *     font fallback, and "Search" just centers inside the same box.
 *   min-height + centering: on mobile the form is `column`, so the button's
 *     height is content-driven and the spinner's box is taller than a plain
 *     text line (it grew 2.5px mid-search). Desktop hid this because `row`
 *     + align-items:stretch pins the button to the input's height. */
.table-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 160px;
    min-height: 44px;
}

.table-search-btn:hover:not(:disabled) {
    background: var(--primary-hover);
}

/* Pending state: still legibly "the search button", visibly not clickable. */
.table-search-btn:disabled {
    cursor: default;
    opacity: 0.75;
}

/* Spinner visibility is CSS-driven off .is-loading rather than x-show — see the
 * template comment; x-show's transition cascade drops updates under overlapping
 * searches. Shares the `spin` keyframes with .table-spinner (base.css); sized
 * down and recolored for the button's filled background. */
.table-search-btn-spinner {
    display: none;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    border: 2px solid rgb(var(--white-rgb) / 0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.table-search-btn.is-loading .table-search-btn-spinner {
    display: block;
}

/* Hide the spinner outright rather than just freezing it: a stationary ring
 * next to "Searching…" reads as broken, which is the opposite of the point.
 * The label and the disabled state carry the pending meaning on their own.
 * Must match the .is-loading rule's specificity (two classes) to beat its
 * display: block — targeting .table-search-btn-spinner alone would lose. */
@media (prefers-reduced-motion: reduce) {
    .table-search-btn.is-loading .table-search-btn-spinner {
        display: none;
    }
}

/* =============================================
   Main Layout - Two Column Grid
   ============================================= */

.table-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    flex: 1;
    min-height: 0;
}

/* =============================================
   Sidebar
   ============================================= */

/* No max-height: as a grid item the sidebar already stretches to the row, so
 * it is bounded by .table-layout and never by a pixel sum. The old
 * `max-height: calc(100vh - 52px - 65px)` (header + search bar) ignored site
 * banners, so during a notice window the sidebar's scroll region ran past the
 * fold; it also cut the column's background off mid-page on long result sets.
 * overflow-y stays so the filters scroll inside the sidebar whenever the row
 * is height-constrained (CCT-322). */
.table-sidebar {
    background: var(--gray-50);
    border-right: 1px solid var(--gray-100);
    padding: 20px;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.sidebar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Filters header with the Clear All button beside the title — the home the
   button moved to when the Active Filters badge strip was retired
   (CCT-380). The title's own bottom margin carries the spacing. */
.sidebar-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

/* Interpretation */
.interpretation-section {
    background: var(--ocean-subtle);
    border-radius: 10px;
    padding: 14px;
    border: none;
    margin-bottom: 20px;
}

.interpretation-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.interpretation-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Filter badges. The sidebar's Active Filters strip is gone (CCT-380 —
   filters display in their own fields now), but the badge look survives
   as the base style of the empty-state relax / did-you-mean pills. */
.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--primary-color);
    color: white;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}

.filter-badge-name {
    opacity: 0.8;
}

.clear-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 16px;
    background: var(--danger-bg);
    color: var(--danger);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clear-all-btn:hover {
    background: var(--danger-border);
    color: var(--danger-strong);
}

/* Filter Fields */
.filter-field {
    margin-bottom: 16px;
}

.filter-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.filter-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--ocean-tint-strong);
}

.filter-select {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
}

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

/* Filter Dropdown */
.filter-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-dropdown-btn:hover {
    border-color: var(--gray-300);
}

.filter-dropdown-panel {
    max-height: 240px;
    overflow-y: auto;
    background: var(--surface-raised);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 6px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgb(var(--black-rgb) / 0.1);
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: background var(--transition-fast);
}

.filter-checkbox:hover {
    background: var(--gray-50);
}

.filter-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

/* Date Range */
.date-range-field .date-range-inputs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.date-range-field .date-input {
    width: 100%;
}

.date-separator {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* Why the custom range wasn't sent (CCT-335). Sits under the two inputs
 * rather than in the results area: the fix is made here, not there. */
.date-range-error {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--red-610);
}

/* Tag/Chip Input (multi-value industry filter) */
.tag-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: var(--surface);
    min-height: 36px;
    align-items: center;
    cursor: text;
}

.tag-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--ocean-tint-strong);
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.tag-chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgb(var(--white-rgb) / 0.25);
    color: white;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.tag-chip-remove:hover {
    background: rgb(var(--white-rgb) / 0.45);
}

.tag-text-input {
    flex: 1;
    min-width: 80px;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: var(--text-primary);
    padding: 2px 0;
}

.tag-text-input::placeholder {
    color: var(--text-secondary);
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
    background: var(--surface-raised);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgb(var(--black-rgb) / 0.1);
    margin-top: 4px;
}

.autocomplete-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.autocomplete-item:hover {
    background: var(--gray-100);
}

/* Toolbar link buttons (e.g., View on Map) */
a.toolbar-btn {
    text-decoration: none;
    color: var(--text-primary);
}

/* =============================================
   Main Content Area
   ============================================= */

.table-main {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    min-height: 0;
    overflow: hidden;
}

/* Toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--header-bg);
    backdrop-filter: saturate(120%) blur(16px);
    -webkit-backdrop-filter: saturate(120%) blur(16px);
    border-bottom: none;
    gap: 16px;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}

.quick-search-wrapper {
    position: relative;
    flex: 1;
    max-width: 300px;
}

.quick-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.quick-search-input {
    width: 100%;
    padding: 8px 8px 8px 34px;
    font-size: 13px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--gray-50);
    color: var(--text-primary);
}

.quick-search-input:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--primary-color);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.results-count {
    font-size: 13px;
    color: var(--text-secondary);
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    background: var(--gray-100);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toolbar-btn:hover:not(:disabled) {
    background: var(--gray-200);
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Saved Search Indicator */
.saved-search-indicator {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 980px;
    background: var(--primary-color);
    color: var(--text-on-accent);
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.saved-search-modified {
    background: var(--gray-200);
    color: var(--text-secondary);
}

/* Saved Searches Dropdown */
.saved-searches-backdrop {
    display: none;
}
.saved-searches-handle {
    display: none;
}
.saved-searches-header {
    display: none;
}
.saved-searches-dropdown {
    position: relative;
    z-index: 51;
}
.saved-searches-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 980px;
    background: var(--primary-color);
    color: var(--text-on-accent);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}
.saved-searches-panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 240px;
    max-width: 320px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg, 0 10px 40px rgb(var(--black-rgb) / 0.15));
    z-index: 60;
    overflow: hidden;
}
.saved-searches-list {
    list-style: none;
    padding: 6px;
    max-height: 300px;
    overflow-y: auto;
}
.saved-searches-list li {
    margin: 0;
}
.saved-search-link {
    display: block;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background var(--transition-fast);
}
.saved-search-link:hover {
    background: var(--gray-100);
}
.saved-search-link.active {
    background: var(--primary-color);
    color: var(--text-on-accent);
}
.saved-searches-manage {
    border-top: 1px solid var(--gray-100);
    margin-top: 4px;
    padding-top: 4px;
}
.saved-searches-manage a {
    display: block;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    text-align: center;
}
.saved-searches-manage a:hover {
    color: var(--primary-color);
}
.saved-searches-empty {
    padding: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* Loading, Error, Empty States */
.table-loading,
.table-error,
.table-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    gap: 16px;
}

.table-error {
    color: var(--red-610);
}
.table-async-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--ocean-light);
    border: 1px solid var(--cyan-200);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* The "×" that closes a .table-async-banner. One rule rather than the same
 * five inline properties on each of the four banners. */
.banner-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 0 4px;
}

.table-empty svg {
    color: var(--gray-300);
}

.empty-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

/* CCT-481: the muted, non-dismissable name-match note under a person filter. */
.name-match-note {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 12px;
}

/* CCT-99 banner — appears above the empty/results region whenever the
 * AI parser flagged a request for fields we don't index. */
.table-empty-banner {
    margin: 12px 0;
    padding: 12px 16px;
    background: var(--orange-50);
    border: 1px solid var(--orange-200);
    border-radius: 10px;
    font-size: 14px;
    color: var(--warning);
}
.empty-banner-line {
    margin: 0 0 4px 0;
}
.empty-banner-line:last-child {
    margin-bottom: 0;
}

/* CCT-100 relax-filter pills inside the empty state. Reuses .filter-badge
 * styling for visual consistency with the active-filter chips. */
.empty-relax {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}
.empty-relax-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.empty-relax-pill {
    cursor: pointer;
    border: 1px solid var(--gray-300);
    background: var(--surface);
    /* Override .filter-badge's white text — these pills sit on a white
       background (not the primary-color chip), so white-on-white was
       invisible. Use the standard dark body text instead. */
    color: var(--text-primary);
    transition: background 120ms ease;
}
.empty-relax-pill:hover {
    background: var(--gray-100);
}

.retry-btn {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    background: var(--gray-100);
    color: var(--text-primary);
    cursor: pointer;
}

.retry-btn:hover {
    background: var(--gray-200);
}

.table-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* =============================================
   Table
   ============================================= */

.table-wrapper {
    flex: 1;
    overflow: auto;
}

.filings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.filings-table th {
    position: sticky;
    top: 0;
    background: var(--gray-50);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    z-index: 10;
}

.filings-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.filings-table th.sortable:hover {
    color: var(--primary-color);
}

.filings-table .sort-indicator {
    margin-left: 4px;
    font-size: 10px;
}

.filings-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: top;
}

.filings-table tbody tr:hover {
    background: var(--gray-50);
}

/* Cell Styles */
.filings-table .cell-corporation-name {
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
}

.filings-table .cell-corporation-name:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.filings-table .cell-corporation-name mark {
    background: var(--warning-bg);
    padding: 0 2px;
    border-radius: 2px;
}

.filings-table .cell-corporation-number {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.filings-table .cell-filing-type {
    display: inline-block;
    padding: 3px 8px;
    background: var(--gray-100);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.filings-table .cell-clickable {
    cursor: pointer;
    color: var(--primary-color);
}

.filings-table .cell-clickable:hover {
    text-decoration: underline;
}

/* Filter Help Icon */
.filter-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    cursor: help;
    vertical-align: middle;
    margin-left: 4px;
}

/* =============================================
   Pagination
   ============================================= */

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--gray-100);
    background: var(--surface);
    flex-shrink: 0;
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.per-page-select {
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: var(--gray-100);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--gray-200);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
}

/* =============================================
   Table-Page Modal Extensions
   ============================================= */

.modal-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text-primary);
    margin-bottom: 16px;
    box-sizing: border-box;
}

.modal-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgb(var(--primary-rgb) / 0.2);
}

/* Column Picker */
.column-picker {
    max-height: 300px;
    overflow-y: auto;
    margin: 16px 0;
}

.column-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.column-option:hover {
    background: var(--gray-50);
}

.column-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* Export Format Type Selector (pill buttons) */
.export-format-selector {
    display: flex;
    gap: 0;
    background: var(--gray-100);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 16px;
}

.format-type-btn {
    flex: 1;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.format-type-btn:hover {
    color: var(--text-primary);
}

.format-type-btn.active {
    background: var(--surface);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgb(var(--black-rgb) / 0.1);
}

/* Export Format Options */
.format-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
}

.format-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.format-option:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

.format-option.selected {
    border-color: var(--primary-color);
    background: var(--ocean-wash);
}

.format-option input[type="radio"] {
    margin-top: 2px;
    accent-color: var(--primary-color);
}

.format-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.format-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.format-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.export-warning {
    background: var(--warning-bg);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    color: var(--orange-850);
}

/* =============================================
   Mobile Filter Toggle
   ============================================= */

.mobile-filter-toggle {
    display: none;
}

/* =============================================
   Mobile Card View
   ============================================= */

.mobile-cards {
    display: none;
}

/* =============================================
   Responsive
   ============================================= */

@media (max-width: 1024px) {
    .table-layout {
        grid-template-columns: 240px 1fr;
    }
}

@media (max-width: 768px) {
    .table-layout {
        grid-template-columns: 1fr;
    }

    /* Full-width and collapsible on mobile; the filters flow with the page
     * instead of scrolling inside their own box. */
    .table-sidebar {
        display: none;
        border-right: none;
        border-bottom: 1px solid var(--gray-100);
        padding: 16px;
    }

    .table-sidebar.open {
        display: block;
    }

    /* Mobile filter toggle */
    .mobile-filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        margin: 12px 16px 0;
        font-size: 14px;
        font-weight: 500;
        border: 1px solid var(--gray-200);
        border-radius: 10px;
        background: var(--surface);
        color: var(--text-primary);
        cursor: pointer;
        transition: all var(--transition-fast);
    }

    .mobile-filter-toggle:hover {
        border-color: var(--primary-color);
        color: var(--primary-color);
    }

    .filter-count-badge {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 20px;
        height: 20px;
        padding: 0 6px;
        border-radius: 10px;
        background: var(--primary-color);
        color: var(--text-on-accent);
        font-size: 11px;
        font-weight: 600;
        line-height: 1;
    }

    /* Let content flow naturally on mobile (no clipping) */
    .table-main {
        overflow: visible;
    }

    /* ...and with nothing clipped, every box between the page shell and the
     * card list keeps its content-based minimum, so none of them can resolve
     * shorter than the cards they paint (CCT-345). A box that comes out short
     * here ends the page shell mid-list, and the shell is what the sticky
     * footer disclaimer is clamped to - that is how the strip ends up drawn
     * across a filing card instead of pinned to the viewport bottom.
     * Scoped to this breakpoint: above it .table-main still clips and the two
     * columns are a height-constrained grid, a layout the bug does not reach,
     * so the CCT-322 floors are left exactly as they are up there.
     *
     * This rule and base.css's `body.page-fills-viewport .page-content` are
     * BOTH load-bearing and neither is redundant with the other: base.css
     * scopes .page-content's dropped floor to the map, while this override
     * lifts the table page's own three floors, which base.css never touches -
     * so deleting either one on the strength of the other reopens CCT-345. */
    .table-page,
    .table-layout,
    .table-main {
        min-height: auto;
    }

    /* Show cards, hide table on mobile */
    .desktop-table {
        display: none !important;
    }

    .mobile-cards {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 12px 16px;
    }

    /* Filing card */
    .filing-card {
        display: block;
        padding: 14px 16px;
        background: var(--surface);
        border: 1px solid var(--gray-100);
        border-radius: 12px;
        text-decoration: none;
        color: var(--text-primary);
        transition: all var(--transition-fast);
    }

    .filing-card:hover,
    .filing-card:active {
        border-color: var(--gray-200);
        box-shadow: 0 2px 8px rgb(var(--black-rgb) / 0.06);
    }

    .filing-card-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        margin-bottom: 6px;
    }

    .filing-card-name {
        font-size: 15px;
        font-weight: 600;
        color: var(--text-primary);
        line-height: 1.3;
        flex: 1;
        min-width: 0;
    }

    .filing-card-name mark {
        background: var(--warning-bg);
        padding: 0 2px;
        border-radius: 2px;
    }

    .filing-card-details {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        color: var(--text-secondary);
        margin-bottom: 8px;
    }

    .filing-card-number {
        font-variant-numeric: tabular-nums;
    }

    .filing-card-dot {
        color: var(--gray-300);
    }

    .filing-card-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .filing-card-industry {
        font-size: 12px;
        color: var(--primary-color);
        background: var(--ocean-subtle);
        padding: 3px 10px;
        border-radius: 980px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 60%;
    }

    .filing-card-date {
        font-size: 12px;
        color: var(--text-secondary);
        white-space: nowrap;
        flex-shrink: 0;
    }

    .table-search-form {
        flex-direction: column;
    }

    .table-toolbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 16px;
    }

    .quick-search-wrapper {
        order: 2;
        max-width: none;
        width: 100%;
    }

    .toolbar-actions {
        order: 1;
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .results-count {
        margin-right: auto;
    }

    /* Saved search features on mobile */
    .saved-search-indicator {
        width: 100%;
        order: -1;
        max-width: none;
        font-size: 12px;
        text-align: center;
        justify-content: center;
    }

    .saved-searches-dropdown {
        order: 3;
    }

    .saved-searches-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgb(var(--black-rgb) / 0.3);
        z-index: 1099;
    }

    .saved-searches-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin-top: 0;
        max-width: none;
        min-width: 0;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 40px rgb(var(--black-rgb) / 0.2);
        z-index: 1100;
        padding-bottom: 60px;
    }

    .saved-searches-handle {
        display: block;
        width: 36px;
        height: 4px;
        background: var(--gray-200);
        border-radius: 2px;
        margin: 10px auto 0;
    }

    .saved-searches-header {
        display: block;
        padding: 12px 16px 4px;
        font-size: 15px;
        font-weight: 600;
        color: var(--text-primary);
    }

    .saved-searches-list {
        max-height: 50vh;
    }

    .saved-search-link {
        padding: 12px 16px;
        font-size: 15px;
    }

    .pagination-info {
        display: none;
    }

    .table-pagination {
        padding: 10px 16px;
        padding-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .table-search-bar {
        padding: 12px 16px;
    }

    .toolbar-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Hide button text, show only icons */
    .toolbar-btn svg + span {
        display: none;
    }

    .mobile-cards {
        padding: 10px 12px;
        gap: 6px;
    }

    .filing-card {
        padding: 12px 14px;
    }

    .filing-card-name {
        font-size: 14px;
    }

    .filing-card-details {
        font-size: 12px;
    }
}

/* =============================================
   Select All Results Banner
   ============================================= */

.select-all-banner {
    padding: 8px 16px;
    background: var(--color-info-bg);
    border: 1px solid var(--color-info-border);
    border-radius: 4px;
    text-align: center;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.select-all-link {
    background: none;
    border: none;
    color: var(--color-link);
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
    padding: 0;
}

/* Alpine.js cloak */
[x-cloak] {
    display: none !important;
}
