.search-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.button {
    height: 40px;
    padding: 0 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.button-primary {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.button-primary:hover {
    background: hsl(var(--primary) / 0.9);
}

.button-primary:active {
    background: hsl(var(--primary) / 0.8);
}

.button-secondary {
    background: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border: 1px solid hsl(var(--border));
}

.button-secondary:hover {
    background: hsl(var(--accent));
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: fixed;
}

thead {
    border-bottom: 1px solid hsl(var(--border));
}

th {
    text-align: left;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    padding: 12px 16px;
    background: hsl(var(--muted) / 0.5);
    user-select: none;
    position: relative;
    transition: background 0.15s ease;
}

th:first-child {
    width: 60px;
    text-align: center;
}

th:nth-child(2) {
    width: 25%;
}

th:nth-child(3) {
    width: 35%;
}

th:nth-child(4) {
    width: auto;
}

th.sortable {
    cursor: pointer;
    padding-right: 32px;
}

th.sortable:hover {
    background: hsl(var(--muted));
}

th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 12px;
    opacity: 0.3;
    font-size: 12px;
    top: 50%;
    transform: translateY(-50%);
}

th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

tbody tr {
    border-bottom: 1px solid hsl(var(--border));
    transition: background 0.15s ease;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: hsl(var(--muted) / 0.5);
}

td {
    padding: 16px;
    color: hsl(var(--foreground));
}

td:first-child {
    text-align: center;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    font-size: 0.8125rem;
}

.email-link {
    color: hsl(var(--foreground));
    text-decoration: none;
    transition: color 0.15s ease;
}

.email-link:hover {
    color: hsl(var(--primary));
    text-decoration: underline;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: calc(var(--radius) - 4px);
    font-size: 0.75rem;
    font-weight: 500;
    background: hsl(142 76% 94%);
    color: hsl(142 76% 26%);
    border: 1px solid hsl(142 76% 86%);
    position: relative;
    cursor: default;
}

.status-badge[data-tooltip] {
    cursor: help;
}

.status-badge[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    padding: 6px 10px;
    background: hsl(var(--popover));
    color: hsl(var(--popover-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.status-badge[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: hsl(var(--border));
    z-index: 1000;
}

.status-badge.status-removed {
    background: hsl(0 72% 94%);
    color: hsl(0 72% 30%);
    border: 1px solid hsl(0 72% 86%);
}

.status-badge.status-removed .status-dot {
    background: hsl(0 72% 45%);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: hsl(142 76% 36%);
    margin-right: 6px;
}

.admin-row {
    background: hsl(var(--admin-bg)) !important;
    border-left: 3px solid hsl(var(--admin-border));
}

.admin-row:hover {
    background: hsl(142 76% 88%) !important;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: calc(var(--radius) - 4px);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    background: hsl(var(--admin-badge));
    color: white;
    margin-left: 8px;
    vertical-align: middle;
}

.name-cell {
    font-weight: 500;
}

.no-results {
    text-align: center;
    padding: 64px 24px;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    display: none;
}

.removed-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid hsl(var(--border));
}

.removed-title {
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 16px;
    padding-left: 25px;
}

#removedTable tbody tr {
    opacity: 0.7;
}

#removedTable tbody tr:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .search-controls {
        flex-direction: column;
    }

    .button {
        width: 100%;
        justify-content: center;
    }

    th, td {
        padding: 12px 8px;
        font-size: 0.8125rem;
    }
}

.dark .status-badge {
    background: hsl(142 76% 15%);
    color: hsl(142 76% 75%);
    border: 1px solid hsl(142 76% 25%);
}

.dark .status-badge.status-removed {
    background: hsl(0 72% 15%);
    color: hsl(0 72% 75%);
    border: 1px solid hsl(0 72% 25%);
}

.dark .status-badge.status-removed .status-dot {
    background: hsl(0 72% 55%);
}

.dark .status-dot {
    background: hsl(142 76% 55%);
}

.dark .admin-row:hover {
    background: hsl(142 76% 15%) !important;
}
