/* Smart table layout */
.smart-table {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 100%;
    overflow: hidden;
}

.smart-table__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    justify-content: space-between;
}

.smart-table__search {
    flex: 1 1 280px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--border-soft, rgba(27, 131, 116, 0.18));
    background: var(--surface, #fff);
    box-shadow: var(--shadow-sm, 0 10px 24px rgba(27, 131, 116, 0.08));
}

.smart-table__search-icon {
    font-size: 1rem;
    color: var(--text-muted, #4a6a61);
}

.smart-table__search input {
    border: none;
    outline: none;
    flex: 1 1 auto;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text-strong, #022c22);
}

.smart-table__search input::placeholder {
    color: var(--text-soft, rgba(3, 66, 54, 0.48));
}

.smart-table__search input:focus-visible {
    outline: none;
}

.smart-table__tools {
    display: flex;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.smart-table__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.smart-table__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(31, 165, 140, 0.1);
    color: var(--accent-700, #13725f);
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    font-size: 0.82rem;
}

.smart-table__chip button {
    border: none;
    background: transparent;
    padding: 0;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    color: inherit;
}

.smart-table__status {
    font-size: 0.85rem;
    color: var(--text-muted, rgba(3, 66, 54, 0.68));
}

.smart-table__filters-panel {
    border: 1px solid var(--border-soft, rgba(27, 131, 116, 0.18));
    border-radius: var(--radius-lg, 16px);
    padding: 1rem;
    background: var(--surface-strong, #fff);
    box-shadow: var(--shadow-md, 0 16px 40px rgba(27, 131, 116, 0.12));
}

.smart-table__filters-panel[hidden] {
    display: none !important;
}

.smart-table__filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.smart-table__filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.smart-table__filter {
    border: 1px dashed var(--border-soft, rgba(27, 131, 116, 0.18));
    border-radius: var(--radius-md, 12px);
    padding: 0.75rem;
    background: var(--surface, rgba(255,255,255,0.92));
}

.smart-table__filter h5 {
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    color: var(--neutral-800, #0b5a4a);
}

.smart-table__filter-search {
    margin-bottom: 0.5rem;
}

.smart-table__filter-search input {
    width: 100%;
    border-radius: var(--radius-sm, 10px);
    border: 1px solid var(--border-soft, rgba(27, 131, 116, 0.18));
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
}

.smart-table__options {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.smart-table__option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-strong, #022c22);
}

.smart-table__option input {
    flex: 0 0 auto;
}

.smart-table__option-count {
    font-size: 0.75rem;
    color: var(--text-muted, rgba(3, 66, 54, 0.68));
}

.smart-table__empty {
    border-radius: var(--radius-md, 12px);
    border: 1px dashed var(--border-soft, rgba(27, 131, 116, 0.18));
    padding: 1rem;
    text-align: center;
    color: var(--text-muted, rgba(3, 66, 54, 0.68));
    background: rgba(27, 131, 116, 0.04);
}

.smart-table__empty[hidden] {
    display: none !important;
}

.smart-table--compact table tbody tr > * {
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
}

.smart-table--compact table td,
.smart-table--compact table th {
    font-size: 0.88rem;
}

.smart-table .smart-table__actions .btn {
    white-space: nowrap;
}

.smart-table .smart-table__filters-toggle {
    position: relative;
}

.smart-table .smart-table__filters-toggle[data-active="true"]::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--danger-500, #ef4444);
}

.smart-table table thead th.smart-table__sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    white-space: normal;
}

.smart-table__sort-icon {
    margin-left: 0.35rem;
    font-size: 0.85rem;
    opacity: 0.45;
    transition: opacity var(--transition-base, 0.2s ease), transform 0.2s ease;
    display: inline-flex;
}

.smart-table table thead th.smart-table__sortable[data-sort="asc"] .smart-table__sort-icon,
.smart-table table thead th.smart-table__sortable[data-sort="desc"] .smart-table__sort-icon {
    opacity: 1;
}

.smart-table__sort-icon[data-neutral="true"] {
    opacity: 0.45 !important;
}

.smart-table table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.smart-table table th,
.smart-table table td {
    white-space: normal;
}

.smart-table .table-modern {
    width: 100%;
    overflow-x: auto;
    max-width: 100%;
}

.smart-table__noscript {
    border: 1px solid var(--border-soft, rgba(27, 131, 116, 0.18));
    border-radius: var(--radius-md, 12px);
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 239, 205, 0.5);
}
