:root {
    --bg: #eef2f7;
    --panel: #f8fafc;
    --panel-border: #d7deea;
    --text: #222f45;
    --muted: #8d9ab1;
    --line: #d8dfeb;
    --blue: #3038a8;
    --blue-soft: #eaf0ff;
    --green: #1a8f4d;
    --green-soft: #eef9f2;
    --red: #c43e3e;
    --red-soft: #fff2f1;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #f4f7fb 0%, var(--bg) 100%);
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 0% 0%, #dfe8ff 0%, rgba(223, 232, 255, 0) 40%),
        radial-gradient(circle at 100% 100%, #d5fff0 0%, rgba(213, 255, 240, 0) 35%),
        linear-gradient(160deg, #eef2fa 0%, #f9fbff 100%);
}

.login-shell {
    width: min(980px, 100%);
    min-height: 520px;
    border-radius: 26px;
    border: 1px solid #d8e0ef;
    background: #ffffff;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    box-shadow: 0 24px 50px rgba(28, 49, 94, 0.16);
}

.login-hero {
    padding: 54px 48px;
    background: linear-gradient(155deg, #0e1e55 0%, #1f3f9f 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-kicker {
    margin: 0 0 16px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.82rem;
    color: rgba(219, 231, 255, 0.9);
    font-weight: 800;
}

.login-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 2.8vw, 3rem);
    line-height: 1.02;
    letter-spacing: -0.03em;
}

.login-copy {
    margin: 20px 0 0;
    max-width: 420px;
    color: rgba(230, 237, 255, 0.95);
    font-size: 1.05rem;
    line-height: 1.5;
}

.login-panel {
    padding: 50px 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
}

.login-panel h2 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: -0.02em;
    color: #1e2a42;
}

.login-subtitle {
    margin: 10px 0 22px;
    color: #6d7d9b;
    font-size: 0.98rem;
}

.login-error {
    border: 1px solid #edc1bf;
    background: #fff3f2;
    color: #8f2f2c;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.9rem;
    margin-bottom: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.login-form label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8090af;
    font-weight: 700;
}

.login-form input {
    height: 46px;
    border-radius: 12px;
    border: 1px solid #ced8e7;
    background: #f4f7fc;
    padding: 0 14px;
    font-size: 1rem;
    color: #1f2f47;
    outline: none;
}

.login-form input:focus {
    border-color: #90a6d8;
    background: #fff;
}

.login-form button {
    margin-top: 10px;
    height: 46px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(140deg, #3344c8 0%, #2a38a5 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
}

.login-form button:hover {
    filter: brightness(1.04);
}

.dashboard-shell {
    width: min(1540px, calc(100% - 52px));
    margin: 20px auto 24px;
}

.error-banner {
    margin-bottom: 12px;
    border-radius: 14px;
    border: 1px solid #e9bbbb;
    background: #fff3f2;
    color: #8e2d2d;
    padding: 12px 14px;
    font-size: 0.92rem;
}

.filters-wrap,
.records-wrap {
    border-radius: 18px;
}

.filters-wrap {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    padding: 24px;
}

.filters-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e6ebf3;
}

.filters-header h1 {
    margin: 0;
    color: var(--blue);
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.icon-chip,
.grid-chip {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
}

.icon-chip {
    background: var(--blue);
    box-shadow: 0 10px 20px rgba(48, 56, 168, 0.24);
}

.filters-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.8fr) repeat(7, minmax(150px, 1fr));
    gap: 14px;
    align-items: end;
}

.range-field {
    display: none;
}

.range-field.active {
    display: block;
}

.field label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #92a0b9;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.field input,
.field select {
    width: 100%;
    height: 44px;
    border: 1px solid #cfd8e6;
    border-radius: 12px;
    background: #f3f6fb;
    color: #2a3447;
    padding: 0 14px;
    font-size: 1rem;
    outline: none;
}

.field input::placeholder {
    color: #9aa6bd;
}

.field input:focus,
.field select:focus {
    border-color: #9ab0df;
    background: #fff;
}

.records-wrap {
    margin-top: 20px;
}

.compare-grid {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(3, minmax(230px, 1fr));
    gap: 12px;
}

.chart-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(300px, 1fr));
    gap: 12px;
}

.chart-card {
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: #fff;
    padding: 14px 16px;
}

.chart-card h3 {
    margin: 0 0 12px;
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6f7f9f;
}

.chart-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.2fr) 2fr auto;
    gap: 10px;
    align-items: center;
}

.chart-label {
    font-size: 0.86rem;
    color: #3b4a67;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-bar-track {
    height: 8px;
    border-radius: 999px;
    background: #edf1f8;
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    border-radius: 999px;
    background: #4060dd;
}

.chart-bar-success {
    background: #16a06f;
}

.chart-value {
    min-width: 30px;
    text-align: right;
    font-size: 0.86rem;
    color: #1f2f49;
}

.compare-card {
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: #fff;
    padding: 14px 16px;
}

.compare-pipe {
    box-shadow: inset 3px 0 0 #335eea;
}

.compare-leads {
    box-shadow: inset 3px 0 0 #0e9f74;
}

.compare-close {
    box-shadow: inset 3px 0 0 #f28a15;
}

.compare-title {
    margin: 0;
    font-size: 0.77rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7383a3;
    font-weight: 800;
}

.compare-total {
    margin: 8px 0 4px;
    font-size: 1.9rem;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #202e47;
    font-weight: 800;
}

.compare-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: #6e7d98;
    font-size: 0.84rem;
}

.records-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.records-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.records-title h2 {
    margin: 0;
    font-size: 2.05rem;
    letter-spacing: -0.03em;
}

.grid-chip {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #82b900;
    font-size: 0.92rem;
}

.records-count {
    min-width: 56px;
    height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #e7edff;
    color: #2e3da5;
    font-weight: 900;
    font-size: 1.45rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.records-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn {
    height: 38px;
    border-radius: 10px;
    padding: 0 16px;
    border: 1px solid transparent;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.action-refresh {
    background: var(--blue);
    color: #fff;
}

.action-logout {
    border-color: #cfd8e8;
    color: #4a5a78;
}

.table-wrap {
    border-radius: 16px;
    border: 1px solid var(--panel-border);
    overflow: auto;
    background: #fff;
}

.records-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.records-table th {
    background: #f4f7fc;
    color: #2f3aa4;
    font-size: 0.78rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid #d9e0ec;
}

.records-table td {
    border-bottom: 1px solid #e3e8f1;
    padding: 14px 16px;
    font-size: 0.95rem;
    vertical-align: middle;
}

.source-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 700;
}

.source-pill {
    color: #3240a8;
    background: #e9edf7;
}

.source-sub {
    display: block;
    margin-top: 6px;
    color: #97a3b8;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.utm-sub {
    display: block;
    margin-top: 3px;
    color: #93a0b7;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}

.lead-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #1f8dc2 0%, #1e4cb5 100%);
    color: #fff;
    font-weight: 800;
    font-size: 0.88rem;
    text-transform: uppercase;
}

.phone-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 7px;
    border: 1px solid #e1e7f0;
    background: #f6f9fc;
    color: #4d5c75;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
}

.vehicle-cell {
    color: #a1adbf;
}

.empty {
    margin: 0;
    color: #73829e;
}

@media (max-width: 980px) {
    .login-body {
        padding: 14px;
    }

    .login-shell {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .login-hero {
        padding: 34px 28px;
    }

    .login-panel {
        padding: 30px 28px;
    }
}

@media (max-width: 640px) {
    .login-hero {
        display: none;
    }

    .login-panel {
        padding: 28px 20px;
    }
}

@media (max-width: 1200px) {
    .compare-grid {
        grid-template-columns: 1fr;
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }

    .filters-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .field-search {
        grid-column: 1 / -1;
    }
}

@media (max-width: 860px) {
    .dashboard-shell {
        width: min(100% - 18px, 1540px);
    }

    .filters-wrap {
        padding: 16px;
    }

    .filters-header {
        margin-bottom: 14px;
        padding-bottom: 12px;
    }

    .filters-header h1 {
        font-size: 1.35rem;
    }

    .records-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .records-title h2 {
        font-size: 1.45rem;
    }

    .records-count {
        min-width: 50px;
        height: 32px;
        font-size: 1.25rem;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }
}
