/* erp-table.css split (1/6): card shell, header, toolbar, search, settings
 * trigger, column-manager, export dropdown UI. Part of the shared visual
 * contract for both the Blade and Vue crud-table engines — see
 * table-contract.md. Loaded in order by erp-table.css; do not import these
 * partials directly or reorder them, the cascade depends on this sequence. */

.erp-table-scroll,
.erp-table-main-scroll,
.erp-table-persistent-horizontal-scroll,
.erp-filter-checklist,
.erp-column-manager {
    scrollbar-width: thin;
    scrollbar-color: rgba(87, 122, 172, 0.38) transparent;
}

.erp-table-scroll::-webkit-scrollbar,
.erp-table-main-scroll::-webkit-scrollbar,
.erp-table-persistent-horizontal-scroll::-webkit-scrollbar,
.erp-filter-checklist::-webkit-scrollbar,
.erp-column-manager::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.erp-table-scroll::-webkit-scrollbar-track,
.erp-table-main-scroll::-webkit-scrollbar-track,
.erp-table-persistent-horizontal-scroll::-webkit-scrollbar-track,
.erp-filter-checklist::-webkit-scrollbar-track,
.erp-column-manager::-webkit-scrollbar-track {
    background: transparent;
}

.erp-table-scroll::-webkit-scrollbar-thumb,
.erp-table-main-scroll::-webkit-scrollbar-thumb,
.erp-table-persistent-horizontal-scroll::-webkit-scrollbar-thumb,
.erp-filter-checklist::-webkit-scrollbar-thumb,
.erp-column-manager::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    background: rgba(87, 122, 172, 0.34);
    background-clip: padding-box;
}

.erp-table-scroll::-webkit-scrollbar-thumb:hover,
.erp-table-main-scroll::-webkit-scrollbar-thumb:hover,
.erp-table-persistent-horizontal-scroll::-webkit-scrollbar-thumb:hover,
.erp-filter-checklist::-webkit-scrollbar-thumb:hover,
.erp-column-manager::-webkit-scrollbar-thumb:hover {
    background: rgba(18, 69, 252, 0.42);
    background-clip: padding-box;
}

.erp-table-card {
    container-name: erp-table;
    container-type: inline-size;
    position: relative;
    margin: 1rem;
}

.erp-table-shell {
    overflow: hidden;
    border: 1px solid var(--divider);
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

/* `clip` keeps the card radius without creating an overflow scroll container.
 * The Vue table's sticky horizontal proxy can therefore remain bounded by the
 * shell while following the application content scroll region. */
.erp-table-card--vue .erp-table-shell {
    overflow: clip;
}

.erp-table-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--divider);
}

.erp-table-title-block {
    min-width: 0;
}

.erp-table-title-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.erp-table-title-icon {
    display: inline-flex;
    width: 2.35rem;
    height: 2.35rem;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid var(--primary-100);
    border-radius: var(--radius-sm);
    background: var(--primary-50);
    color: var(--primary);
}

.erp-table-title-copy {
    min-width: 0;
}

.erp-table-title-block h3 {
    margin: 0;
    color: var(--color-kview);
    font-size: 1.35rem;
    line-height: 1.2;
}

.erp-table-title-block p {
    margin: 0.2rem 0 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.erp-table-eyebrow {
    margin: 0 0 0.25rem;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.erp-table-header-actions,
.erp-table-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.erp-table-toolbar-actions :is(
    .erp-table-import-export,
    .erp-bulk-delete-trigger,
    .erp-table-create
) {
    border-radius: var(--radius-control);
}

.erp-table-header-actions:empty {
    display: none;
}

.erp-table-settings {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.erp-table-settings-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.erp-table-settings-trigger[aria-expanded="true"] {
    border-color: var(--primary-100);
    background: var(--primary-50);
    color: var(--primary);
    outline: none;
}

.erp-table-settings-panel {
    position: absolute;
    z-index: var(--z-dropdown);
    top: calc(100% + 0.55rem);
    right: 0;
    width: min(320px, calc(100vw - 2rem));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-popover);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.erp-table-settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--divider);
}

.erp-table-settings-head strong {
    color: var(--color-kview);
    font-size: 0.85rem;
}

.erp-link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.erp-column-manager {
    display: grid;
    max-height: 320px;
    overflow-y: auto;
    padding: 0.4rem;
}

.erp-column-manager-item {
    display: grid;
    grid-template-columns: 18px 18px minmax(0, 1fr);
    gap: 0.45rem;
    align-items: center;
    min-height: 34px;
    padding: 0.35rem 0.45rem;
    border-radius: var(--radius-sm);
    color: var(--color-ink);
    font-size: 0.82rem;
    cursor: grab;
}

.erp-column-manager-item:hover {
    background: var(--primary-50);
}

.erp-column-manager-item input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}

.erp-drag-handle {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.erp-table-server-filters {
    padding: 0.9rem 1rem 0;
}

.erp-table-filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem 1rem;
    align-items: end;
}

.erp-table-filter-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.erp-table-toolbar {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
}

.erp-table-toolbar::after {
    position: absolute;
    right: 1rem;
    bottom: 0;
    left: 1rem;
    height: 2px;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    content: "";
    opacity: 0;
    transform: scaleX(0.25);
    transition: opacity 120ms ease;
    pointer-events: none;
}

.erp-table-card.is-erp-processing .erp-table-toolbar::after {
    opacity: 0.8;
    animation: tableProcessingSweep 850ms ease-in-out infinite;
}

.erp-table-toolbar-leading {
    display: flex;
    align-items: center;
    min-width: 0;
}

.erp-table-search-group {
    display: flex;
    width: min(460px, 100%);
    min-width: 0;
    align-items: stretch;
}

.erp-table-toolbar-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.erp-table-selection-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    flex: 0 0 auto;
}

.erp-table-search {
    position: relative;
    display: flex;
    align-items: center;
    width: auto;
    min-width: 96px;
    flex: 1 1 auto;
    height: 38px;
}

.erp-table-search > .kv-icon {
    position: absolute;
    left: 0.8rem;
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 1;
}

.erp-table-search input {
    width: 100%;
    height: 100%;
    padding: 0 0.85rem 0 2.2rem;
    border: 1px solid var(--border-strong);
    border-radius: 8px 0 0 8px;
    background: var(--surface-alt);
    color: var(--color-ink);
    font-family: inherit;
    font-size: 0.9rem;
    outline: 0;
}

.erp-table-search-group .erp-table-settings-trigger {
    width: 38px;
    min-width: 38px;
    height: 38px;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    box-shadow: none;
}

.erp-table-search-group:focus-within .erp-table-search input,
.erp-table-search-group:focus-within .erp-table-settings-trigger {
    position: relative;
    z-index: 1;
}

.erp-table-search input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: var(--shadow-focus);
}

.erp-selection-count {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    padding: 0 0.25rem;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.erp-bulk-delete-form {
    margin: 0;
}

.erp-bulk-delete-trigger {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.erp-table-create {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.erp-table-import-export {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}
