:root {
    --background: #07111f;
    --sidebar: #0a1728;
    --surface: #101e31;
    --surface-2: #14253a;
    --surface-3: #0a1626;
    --border: #263950;
    --border-soft: rgba(255, 255, 255, 0.07);
    --text: #f8fafc;
    --muted: #91a3ba;
    --muted-dark: #6f829b;
    --green: #38d99d;
    --green-hover: #4ce7ae;
    --blue: #5c92ff;
    --danger: #ff7070;
    --warning: #f4c65b;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.24);
    --sidebar-width: 255px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(
            circle at top right,
            rgba(92, 146, 255, 0.07),
            transparent 30%
        ),
        var(--background);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button,
a,
input,
select {
    -webkit-tap-highlight-color: transparent;
}

.mobile-overlay {
    display: none;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns:
        var(--sidebar-width)
        minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 17px;
    border-right: 1px solid var(--border);
    background:
        linear-gradient(
            180deg,
            rgba(56, 217, 157, 0.06),
            transparent 32%
        ),
        var(--sidebar);
    z-index: 50;
}

.brand-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 5px 7px 25px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background:
        linear-gradient(
            135deg,
            var(--green),
            var(--blue)
        );
    color: #041510;
    font-size: 14px;
    font-weight: 900;
    box-shadow:
        0 12px 28px
        rgba(56, 217, 157, 0.2);
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    font-size: 17px;
}

.brand span {
    margin-top: 4px;
    color: var(--green);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.navigation {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.navigation-label {
    margin: 18px 10px 6px;
    color: var(--muted-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.navigation-item {
    width: 100%;
    min-height: 45px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--muted);
    text-align: left;
    text-decoration: none;
    transition:
        color 0.18s ease,
        border-color 0.18s ease,
        background 0.18s ease;
}

.navigation-item small {
    margin-left: auto;
    color: var(--muted-dark);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.navigation-item:hover:not(.disabled),
.navigation-item.active {
    border-color:
        rgba(56, 217, 157, 0.23);
    background:
        rgba(56, 217, 157, 0.09);
    color: var(--text);
}

.navigation-item.active
.navigation-icon {
    color: var(--green);
}

.navigation-item.disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.navigation-icon {
    width: 20px;
    text-align: center;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 17px;
    border-top: 1px solid var(--border);
}

.source-card {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.025);
}

.source-card strong,
.source-card small {
    display: block;
}

.source-card strong {
    font-size: 11px;
}

.source-card small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.live-dot {
    width: 9px;
    height: 9px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--green);
    box-shadow:
        0 0 0 5px
        rgba(56, 217, 157, 0.12);
}

.version {
    display: block;
    margin: 12px 5px 0;
    color: var(--muted-dark);
    font-size: 9px;
}

.main-content {
    min-width: 0;
    padding: 30px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
}

.topbar-title {
    flex: 1;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--green);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.15em;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
}

.topbar p:not(.eyebrow) {
    max-width: 650px;
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.55;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

.icon-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 18px;
}

.mobile-only {
    display: none;
}

.quick-search-card,
.panel {
    border: 1px solid var(--border);
    border-radius: 17px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.quick-search-card {
    margin-bottom: 18px;
    padding: 22px;
}

.quick-search-heading,
.panel-heading,
.results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.quick-search-heading {
    margin-bottom: 18px;
}

.quick-search-heading h2,
.panel-heading h2,
.results-toolbar h2 {
    margin: 0;
    font-size: 20px;
}

.quick-search-heading p:not(.eyebrow),
.panel-heading p:not(.eyebrow),
.results-toolbar p:not(.eyebrow) {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.universal-search {
    display: grid;
    grid-template-columns:
        auto
        minmax(0, 1fr)
        auto;
    gap: 10px;
    align-items: center;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-3);
}

.search-symbol {
    margin-left: 7px;
    color: var(--green);
    font-size: 23px;
}

.universal-search input {
    min-width: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.panel {
    margin-bottom: 18px;
    overflow: hidden;
}

.filters-panel {
    padding: 23px;
}

.panel-heading {
    margin-bottom: 8px;
}

.filter-section {
    padding: 22px 0;
    border-top: 1px solid var(--border-soft);
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 15px;
}

.section-heading > span {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 9px;
    background:
        rgba(56, 217, 157, 0.1);
    color: var(--green);
    font-size: 11px;
    font-weight: 900;
}

.section-heading strong,
.section-heading small {
    display: block;
}

.section-heading strong {
    font-size: 13px;
}

.section-heading small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.filter-grid {
    display: grid;
    gap: 14px;
}

.four-columns {
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
}

.three-columns {
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
}

.two-columns {
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field > span {
    color: #c8d3e0;
    font-size: 11px;
    font-weight: 750;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: var(--surface-3);
    color: var(--text);
    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

input::placeholder {
    color: #5f728a;
}

input:focus,
select:focus {
    border-color: var(--green);
    box-shadow:
        0 0 0 3px
        rgba(56, 217, 157, 0.1);
}

.input-suffix {
    position: relative;
}

.input-suffix input {
    padding-right: 76px;
}

.input-suffix span {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 10px;
}

.date-mode-control {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.date-mode-control label,
.checkbox-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-3);
    color: #c8d3e0;
    font-size: 11px;
}

.date-mode-control input,
.checkbox-field input,
table input[type="checkbox"] {
    width: 16px;
    min-height: auto;
    height: 16px;
    padding: 0;
    accent-color: var(--green);
}

.quick-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 13px;
}

.preset-button {
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}

.preset-button:hover {
    border-color:
        rgba(56, 217, 157, 0.45);
    color: var(--green);
}

.quality-grid {
    display: grid;
    grid-template-columns:
        minmax(0, 1.5fr)
        minmax(180px, 0.75fr)
        minmax(180px, 0.75fr);
    gap: 14px;
    align-items: end;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.filter-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding-top: 20px;
    border-top: 1px solid var(--border-soft);
}

.filter-footer strong,
.filter-footer span {
    display: block;
}

.filter-footer strong {
    font-size: 12px;
}

.filter-footer span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

.button {
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 800;
    transition:
        transform 0.15s ease,
        background 0.15s ease,
        border-color 0.15s ease,
        opacity 0.15s ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.43;
}

.button-primary {
    background: var(--green);
    color: #041812;
}

.button-primary:hover:not(:disabled) {
    background: var(--green-hover);
}

.button-secondary {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.button-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.button-ghost:hover:not(:disabled) {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.button.large {
    min-width: 180px;
}

.metrics-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card {
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric-card span,
.metric-card strong,
.metric-card small {
    display: block;
}

.metric-card span {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 10px;
}

.metric-card strong {
    margin-bottom: 6px;
    font-size: 22px;
}

.metric-card small {
    color: var(--muted-dark);
    font-size: 9px;
}

.results-panel {
    padding-bottom: 4px;
}

.results-toolbar {
    padding: 22px 22px 0;
}

.selection-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.message-box {
    margin: 17px 22px 0;
    padding: 12px 14px;
    border: 1px solid
        rgba(255, 112, 112, 0.34);
    border-radius: 10px;
    background:
        rgba(255, 112, 112, 0.08);
    color: #ffc4c4;
    font-size: 11px;
    line-height: 1.5;
}

.state-box {
    min-height: 255px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

.state-box strong {
    color: var(--text);
}

.state-box span {
    max-width: 460px;
    font-size: 11px;
    line-height: 1.5;
}

.empty-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin-bottom: 5px;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--surface-2);
    color: var(--green);
    font-size: 24px;
}

.spinner {
    width: 34px;
    height: 34px;
    margin-bottom: 7px;
    border: 4px solid
        rgba(255, 255, 255, 0.1);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.table-container {
    width: 100%;
    margin-top: 18px;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 1450px;
    border-collapse: collapse;
}

thead {
    background: var(--sidebar);
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

td {
    color: #d7e1ed;
    font-size: 11px;
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background:
        rgba(92, 146, 255, 0.045);
}

.company-cell {
    max-width: 250px;
    white-space: normal;
}

.company-name {
    display: block;
    color: var(--text);
    font-weight: 800;
}

.dba-name {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
}

.email-link,
.phone-link {
    color: #90b4ff;
    text-decoration: none;
}

.email-link:hover,
.phone-link:hover {
    text-decoration: underline;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    background:
        rgba(56, 217, 157, 0.1);
    color: var(--green);
    font-size: 9px;
    font-weight: 900;
}

.status-badge.inactive {
    background:
        rgba(255, 112, 112, 0.1);
    color: var(--danger);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-top: 1px solid var(--border);
}

.pagination span {
    color: var(--muted);
    font-size: 11px;
}

.hidden {
    display: none !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1200px) {
    .four-columns {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .quality-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .checkbox-group {
        grid-column: 1 / -1;
    }
}

@media (max-width: 960px) {
    .mobile-only {
        display: grid;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(
            var(--sidebar-width),
            88vw
        );
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow:
            20px 0 50px
            rgba(0, 0, 0, 0.38);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(0, 0, 0, 0.62);
    }

    .mobile-overlay.open {
        display: block;
    }

    .main-content {
        padding: 22px;
    }

    .metrics-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .main-content {
        padding: 15px;
    }

    .topbar,
    .quick-search-heading,
    .panel-heading,
    .results-toolbar,
    .filter-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions,
    .topbar-actions .button {
        width: 100%;
    }

    .universal-search {
        grid-template-columns:
            auto
            minmax(0, 1fr);
    }

    .universal-search .button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .four-columns,
    .three-columns,
    .two-columns,
    .quality-grid,
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .checkbox-group {
        grid-column: auto;
    }

    .filter-footer .button {
        width: 100%;
    }

    .selection-tools {
        width: 100%;
    }

    .selection-tools .button {
        flex: 1;
    }

    .quick-search-card,
    .filters-panel {
        padding: 17px;
    }

    th,
    td {
        padding: 12px;
    }
}
