.sf-search-row {
    display: flex;
    gap: 0.5rem;
}

.sf-search-row .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.sf-search-row .btn {
    flex: 0 0 auto;
}

/* The tiles are both the summary and the filter: one click from a count to its hosts. */
.sf-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
    gap: 0.5rem;
}

.sf-tile {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(128, 128, 128, 0.3);
    border-radius: 0.5rem;
    background: transparent;
    color: inherit;
    text-align: start;
    cursor: pointer;
}

.sf-tile:hover {
    border-color: #8f5aff;
}

.sf-tile[aria-pressed="true"] {
    border-color: #8f5aff;
    box-shadow: inset 0 0 0 1px #8f5aff;
    background: rgba(143, 90, 255, 0.08);
}

.sf-tile-count {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
}

.sf-tile-label {
    font-size: 0.8125rem;
    opacity: 0.75;
}

.sf-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.sf-toolbar .form-control {
    flex: 1 1 14rem;
    width: auto;
}

.sf-actions {
    display: flex;
    gap: 0.25rem;
}

.sf-table {
    table-layout: fixed;
}

.sf-table th:nth-child(1) {
    width: 32%;
}

.sf-table th:nth-child(2) {
    width: 17%;
}

.sf-table th:nth-child(4) {
    width: 15%;
}

.sf-table th {
    white-space: nowrap;
}

.sf-table td {
    vertical-align: top;
    overflow-wrap: anywhere;
}

.sf-sort {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-weight: inherit;
    cursor: pointer;
}

th[aria-sort="ascending"] .sf-sort::after {
    content: " \2191";
}

th[aria-sort="descending"] .sf-sort::after {
    content: " \2193";
}

.sf-line {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Own badges: the theme overrides the text color of .badge-success with the brand purple. */
.sf-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.sf-badge--ok { background: rgba(25, 135, 84, 0.15); color: #146c43; }
.sf-badge--redirect { background: rgba(13, 110, 253, 0.12); color: #0a58ca; }
.sf-badge--error { background: rgba(255, 153, 0, 0.18); color: #8a5300; }
.sf-badge--server { background: rgba(220, 53, 69, 0.14); color: #b02a37; }
.sf-badge--muted { background: rgba(128, 128, 128, 0.16); color: #5c636a; }
.sf-badge--note { margin-inline-start: 0.25rem; background: rgba(143, 90, 255, 0.14); color: #6b3fd4; }

html.dark .sf-badge--ok { color: #75d6a5; }
html.dark .sf-badge--redirect { color: #8ab8ff; }
html.dark .sf-badge--error { color: #ffc266; }
html.dark .sf-badge--server { color: #f1909a; }
html.dark .sf-badge--muted { color: #b5bcc4; }
html.dark .sf-badge--note { color: #c0a4ff; }

/* Below 768px the columns do not fit: every row becomes a compact card. */
@media (max-width: 767.98px) {
    .sf-tiles {
        grid-template-columns: repeat(3, 1fr);
    }

    .sf-tile {
        padding: 0.375rem 0.5rem;
    }

    .sf-actions {
        flex: 1 1 100%;
    }

    .sf-actions .btn {
        flex: 1 1 auto;
        white-space: nowrap;
    }

    .table.sf-table,
    .table.sf-table tbody {
        display: block;
        width: 100%;
    }

    .table.sf-table thead {
        display: none;
    }

    .table.sf-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.125rem 0.5rem;
        padding: 0.625rem 0;
        border-top: 1px solid rgba(128, 128, 128, 0.25);
        background: transparent;
    }

    .table.sf-table td {
        display: block;
        border: 0;
        padding: 0;
    }

    .table.sf-table td:nth-child(3),
    .table.sf-table td:nth-child(4) {
        grid-column: 1 / -1;
    }

    .table.sf-table td:empty {
        display: none;
    }
}

/* Search history */
#sf-history .sf-history-item { display: flex; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; padding-left: .75rem; padding-right: .75rem; border-radius: .375rem; }
.sf-history-item.is-current { background: #f7f4ff; }
.sf-history-domain { font-weight: 600; color: #1f1f1e; overflow-wrap: anywhere; }
.sf-history-meta { display: flex; flex-wrap: wrap; gap: .25rem .875rem; font-size: .8125rem; color: #6c757d; white-space: nowrap; }
@media (max-width: 575.98px) {
    #sf-history .sf-history-item { flex-direction: column; }
}
