* {
    box-sizing: border-box;
}

:root {
    --bg: #0a0d14;
    --bg-soft: #10141f;
    --panel: #151a26;
    --panel-2: #1a202e;
    --panel-3: #202738;

    --border: #293144;
    --border-soft: #22293a;

    --text: #f4f7fb;
    --muted: #8993a7;
    --muted-2: #687387;

    --accent: #ff3b30;
    --accent-soft: rgba(255, 59, 48, 0.13);

    --green: #36d48f;
    --green-soft: rgba(54, 212, 143, 0.13);

    --blue: #5f8cff;

    --radius: 16px;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}


html {
    background: var(--bg);
}


body {
    margin: 0;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:
        radial-gradient(
            circle at top left,
            rgba(53, 76, 130, 0.18),
            transparent 34%
        ),
        var(--bg);

    color: var(--text);
    min-height: 100vh;
}


button,
select,
input {
    font: inherit;
}


button,
a,
select {
    transition: all 0.18s ease;
}


a {
    color: inherit;
    text-decoration: none;
}


.app-shell {
    width: min(1500px, calc(100% - 40px));
    margin: 0 auto;
    padding-bottom: 60px;
}


/* TOP NAV */

.topbar {
    height: 84px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid var(--border-soft);
}


.brand-wrap {
    display: flex;
    align-items: center;
    gap: 13px;
}


.brand-mark {
    width: 42px;
    height: 42px;

    border-radius: 11px;

    background:
        linear-gradient(
            135deg,
            #ff4b3e,
            #bf1610
        );

    display: grid;
    place-items: center;

    font-size: 14px;
    font-weight: 900;

    box-shadow:
        0 8px 25px rgba(255, 59, 48, 0.26);
}


.brand {
    font-size: 19px;
    font-weight: 900;
    letter-spacing: 0.7px;
}


.brand span {
    color: var(--accent);
}


.sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}


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


.dealer-selector {
    min-width: 215px;

    background: var(--panel);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 9px;

    padding: 9px 12px;

    outline: none;
}


.ghost-btn {
    background: transparent;
    color: var(--muted);

    border: 1px solid var(--border);
    border-radius: 9px;

    padding: 9px 15px;

    cursor: pointer;
}


.ghost-btn:hover {
    background: var(--panel);
    color: var(--text);
}


/* HERO */

.dealer-hero {
    margin-top: 30px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 27px 29px;

    background:
        linear-gradient(
            120deg,
            rgba(31, 39, 58, 0.95),
            rgba(18, 22, 33, 0.95)
        );

    border: 1px solid var(--border);
    border-radius: var(--radius);

    box-shadow: var(--shadow);
}


.eyebrow {
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.8px;
    margin-bottom: 8px;
}


.dealer-hero h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -0.6px;
}


.hero-meta {
    margin-top: 11px;

    display: flex;
    align-items: center;
    gap: 15px;

    font-size: 12px;
    color: var(--muted);
}


.integration-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    color: var(--green);
    font-weight: 700;
}


.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;
    background: var(--green);

    box-shadow:
        0 0 10px rgba(54, 212, 143, 0.75);
}


.integration-status.offline {
    color: var(--muted);
}


.integration-status.offline .status-dot {
    background: var(--muted);
    box-shadow: none;
}


.primary-btn {
    border: 0;

    border-radius: 10px;

    padding: 11px 18px;

    background:
        linear-gradient(
            135deg,
            #ff4a3d,
            #d71d16
        );

    color: white;

    font-weight: 750;

    cursor: pointer;

    box-shadow:
        0 10px 25px rgba(255, 59, 48, 0.20);
}


.primary-btn:hover {
    transform: translateY(-1px);

    box-shadow:
        0 12px 30px rgba(255, 59, 48, 0.28);
}


.sync-icon {
    font-size: 16px;
    margin-right: 4px;
}


/* STATS */

.stats-grid {
    margin-top: 18px;

    display: grid;
    grid-template-columns: repeat(5, 1fr);

    gap: 13px;
}


.stat-card {
    min-height: 90px;

    padding: 16px;

    background: var(--panel);

    border: 1px solid var(--border-soft);
    border-radius: 13px;

    display: flex;
    align-items: center;

    gap: 13px;
}


.stat-icon {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border-radius: 9px;

    background: var(--panel-3);

    color: var(--accent);

    font-size: 13px;
    font-weight: 900;
}


.stat-card strong {
    display: block;

    font-size: 23px;
    line-height: 1;
}


.stat-card span {
    display: block;

    margin-top: 5px;

    font-size: 11px;
    color: var(--muted);
}


/* INTEGRATION */

.integration-card {
    margin-top: 18px;

    padding: 18px 20px;

    background: var(--panel);

    border: 1px solid var(--border-soft);
    border-radius: 13px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}


.integration-left {
    display: flex;
    align-items: center;
    gap: 13px;
}


.integration-icon {
    width: 40px;
    height: 40px;

    display: grid;
    place-items: center;

    border-radius: 10px;

    background: var(--green-soft);

    color: var(--green);

    font-weight: 900;
}


.integration-left h3 {
    margin: 0;

    font-size: 14px;
}


.integration-left p {
    margin: 4px 0 0;

    color: var(--muted);

    font-size: 11px;
}


.integration-details {
    display: flex;
    gap: 28px;
}


.integration-detail {
    display: flex;
    flex-direction: column;
    gap: 3px;
}


.integration-detail span {
    color: var(--muted);

    font-size: 10px;
    text-transform: uppercase;

    letter-spacing: 0.7px;
}


.integration-detail strong {
    font-size: 12px;
}


.good-text {
    color: var(--green);
}


/* MAIN GRID */

.workspace-grid {
    margin-top: 18px;

    display: grid;

    grid-template-columns:
        minmax(0, 1.65fr)
        minmax(340px, 0.85fr);

    gap: 18px;
}


.workspace-panel {
    min-width: 0;

    background: var(--panel);

    border: 1px solid var(--border-soft);
    border-radius: var(--radius);

    overflow: hidden;
}


.panel-toolbar {
    padding: 18px 20px 13px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}


.panel-toolbar h2 {
    margin: 0;

    font-size: 17px;
}


.panel-toolbar p {
    margin: 4px 0 0;

    color: var(--muted);

    font-size: 11px;
}


.count-badge {
    min-width: 32px;
    height: 27px;

    padding: 0 9px;

    display: grid;
    place-items: center;

    border-radius: 8px;

    background: var(--panel-3);

    color: var(--muted);

    font-size: 11px;
    font-weight: 800;
}


/* SEARCH */

.search-row {
    padding: 0 20px 14px;

    display: flex;
    align-items: center;
    gap: 10px;
}


.search-box {
    flex: 1;

    display: flex;
    align-items: center;
    gap: 8px;

    background: var(--bg-soft);

    border: 1px solid var(--border);

    border-radius: 9px;

    padding: 9px 11px;
}


.search-box span {
    color: var(--muted);
}


.search-box input {
    width: 100%;

    border: 0;
    outline: 0;

    color: var(--text);

    background: transparent;

    font-size: 12px;
}


.search-box input::placeholder {
    color: #5e687b;
}


.filter-chips {
    display: flex;
    gap: 5px;
}


.filter-chip {
    padding: 7px 10px;

    border-radius: 8px;

    border: 1px solid var(--border);

    background: transparent;

    color: var(--muted);

    font-size: 10px;
    font-weight: 750;

    cursor: pointer;
}


.filter-chip:hover {
    color: var(--text);
}


.filter-chip.active {
    background: var(--accent-soft);

    border-color: rgba(255, 59, 48, 0.35);

    color: #ff6a62;
}


/* VEHICLES */

.scroll-table {
    height: 510px;

    overflow-y: auto;

    border-top: 1px solid var(--border-soft);
}


.vehicle-table,
.activity-content table {
    width: 100%;
    border-collapse: collapse;
}


.vehicle-table thead {
    position: sticky;
    top: 0;

    z-index: 2;

    background: #121722;
}


.vehicle-table th,
.vehicle-table td {
    text-align: left;

    padding: 12px 15px;

    border-bottom: 1px solid var(--border-soft);
}


.vehicle-table th {
    color: var(--muted);

    font-size: 9px;

    text-transform: uppercase;

    letter-spacing: 0.7px;
}


.vehicle-table td {
    font-size: 11px;
}


.vehicle-row:hover {
    background: rgba(255,255,255,0.018);
}


.stock-number {
    display: block;
}


.condition-label {
    display: block;

    margin-top: 3px;

    color: var(--muted-2);

    font-size: 8px;
}


.vehicle-name {
    font-weight: 650;
}


.vehicle-table small {
    color: var(--muted);

    display: block;

    margin-top: 3px;
}


.price {
    font-size: 13px;
}


.tag-link {
    color: #8ba9ff;
    font-weight: 700;
}


.tag-link:hover {
    color: white;
}


.unassigned-label {
    color: var(--muted-2);
    font-size: 10px;
}


/* TAGS */

.tag-scroll {
    height: 510px;

    overflow-y: auto;

    border-top: 1px solid var(--border-soft);
}


.tag-card {
    min-height: 78px;

    padding: 14px 17px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    border-bottom: 1px solid var(--border-soft);
}


.tag-card:hover {
    background: rgba(255,255,255,0.018);
}


.tag-info {
    min-width: 130px;
}


.tag-topline {
    display: flex;
    align-items: center;
    gap: 9px;

    font-size: 12px;
}


.battery {
    padding: 3px 6px;

    border-radius: 5px;

    background: var(--green-soft);

    color: var(--green);

    font-size: 8px;
    font-weight: 800;
}


.tag-status {
    margin-top: 5px;

    color: var(--muted);

    font-size: 9px;
}


.mini-status-dot {
    width: 5px;
    height: 5px;

    display: inline-block;

    margin-right: 4px;

    background: var(--green);

    border-radius: 50%;
}


.tag-action {
    flex: 1;

    display: flex;
    justify-content: flex-end;
}


.assign-form {
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 6px;
}


.assign-form select {
    max-width: 210px;

    background: var(--bg-soft);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 7px;

    padding: 7px;

    font-size: 9px;
}


.assign-form button,
.secondary-btn {
    background: var(--panel-3);

    color: var(--text);

    border: 1px solid var(--border);

    border-radius: 7px;

    padding: 7px 10px;

    font-size: 9px;

    cursor: pointer;
}


.assign-form button:hover,
.secondary-btn:hover {
    border-color: #4a566f;

    background: #293247;
}


/* SYSTEM ACTIVITY */

.system-section {
    margin-top: 22px;
}


.section-title {
    margin-bottom: 12px;
}


.section-title h2 {
    margin: 0;

    font-size: 17px;
}


.section-title p {
    margin: 4px 0 0;

    color: var(--muted);

    font-size: 11px;
}


.activity-panel {
    margin-bottom: 8px;

    background: var(--panel);

    border: 1px solid var(--border-soft);

    border-radius: 11px;

    overflow: hidden;
}


.activity-panel summary {
    padding: 14px 17px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    list-style: none;

    cursor: pointer;
}


.activity-panel summary::-webkit-details-marker {
    display: none;
}


.activity-panel summary:hover {
    background: rgba(255,255,255,0.018);
}


.activity-panel summary strong {
    display: block;

    font-size: 12px;
}


.activity-panel summary span {
    display: block;

    margin-top: 3px;

    color: var(--muted);

    font-size: 9px;
}


.summary-right {
    display: flex;
    align-items: center;
    gap: 13px;

    color: var(--muted);

    font-size: 9px;
}


.chevron {
    font-size: 15px !important;
}


.activity-content {
    border-top: 1px solid var(--border-soft);
}


.activity-scroll {
    max-height: 300px;
    overflow-y: auto;
}


.activity-content th,
.activity-content td {
    padding: 10px 15px;

    border-bottom: 1px solid var(--border-soft);

    text-align: left;

    font-size: 10px;
}


.activity-content th {
    color: var(--muted);

    font-size: 8px;

    text-transform: uppercase;
}


/* EVENTS */

.event-row {
    padding: 12px 15px;

    border-bottom: 1px solid var(--border-soft);
}


.event-row strong {
    font-size: 11px;
}


.event-stock {
    margin-left: 7px;

    padding: 3px 6px;

    border-radius: 5px;

    background: var(--panel-3);

    color: var(--muted);

    font-size: 8px;
}


.event-row small {
    display: block;

    margin-top: 5px;

    color: var(--muted);

    line-height: 1.5;

    font-size: 9px;
}


/* JOB STATUS */

.status {
    display: inline-flex;

    padding: 3px 7px;

    border-radius: 5px;

    font-size: 8px;
    font-weight: 800;

    text-transform: uppercase;
}


.status.confirmed {
    background: var(--green-soft);
    color: var(--green);
}


.status.queued {
    background: rgba(95, 140, 255, 0.13);
    color: #8ba9ff;
}


.status.failed {
    background: var(--accent-soft);
    color: #ff6a62;
}


/* EMPTY */

.empty-state {
    min-height: 260px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;

    color: var(--muted);
}


.empty-icon {
    width: 44px;
    height: 44px;

    margin-bottom: 10px;

    display: grid;
    place-items: center;

    border-radius: 11px;

    background: var(--panel-3);

    color: var(--muted);
}


.empty-state h3 {
    margin: 0;

    color: var(--text);

    font-size: 13px;
}


.empty-state p {
    margin: 5px 0 0;

    font-size: 10px;
}


.muted {
    color: var(--muted);
}


/* SCROLLBARS */

.scroll-table::-webkit-scrollbar,
.tag-scroll::-webkit-scrollbar,
.activity-scroll::-webkit-scrollbar {
    width: 7px;
}


.scroll-table::-webkit-scrollbar-track,
.tag-scroll::-webkit-scrollbar-track,
.activity-scroll::-webkit-scrollbar-track {
    background: transparent;
}


.scroll-table::-webkit-scrollbar-thumb,
.tag-scroll::-webkit-scrollbar-thumb,
.activity-scroll::-webkit-scrollbar-thumb {
    background: #30394d;

    border-radius: 20px;
}


.scroll-table::-webkit-scrollbar-thumb:hover,
.tag-scroll::-webkit-scrollbar-thumb:hover,
.activity-scroll::-webkit-scrollbar-thumb:hover {
    background: #434e67;
}


/* FOOTER */

.footer {
    margin-top: 26px;

    text-align: center;

    color: #4d5668;

    font-size: 9px;

    letter-spacing: 0.4px;
}


/* RESPONSIVE */

@media (max-width: 1050px) {

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

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

}


@media (max-width: 720px) {

    .app-shell {
        width: min(
            100% - 22px,
            1500px
        );
    }

    .topbar {
        height: auto;

        padding: 15px 0;

        gap: 15px;

        align-items: flex-start;
    }

    .top-actions {
        flex-direction: column;

        align-items: flex-end;
    }

    .dealer-selector {
        min-width: 180px;
    }

    .dealer-hero {
        align-items: flex-start;

        gap: 20px;

        flex-direction: column;
    }

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

    .integration-card {
        align-items: flex-start;

        flex-direction: column;

        gap: 15px;
    }

    .integration-details {
        width: 100%;

        justify-content: space-between;
    }

    .search-row {
        align-items: stretch;

        flex-direction: column;
    }

}


/* USERS & PERMISSIONS */

.nav-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.notice {
    margin-top: 18px;
    padding: 12px 15px;

    border-radius: 10px;

    font-size: 11px;
    font-weight: 700;
}

.success-notice {
    background: var(--green-soft);
    border: 1px solid rgba(54, 212, 143, 0.28);
    color: var(--green);
}

.users-panel,
.add-user-panel {
    margin-top: 18px;
}

.users-list {
    border-top: 1px solid var(--border-soft);
}

.user-card {
    padding: 18px 20px;

    border: 0;
    border-bottom: 1px solid var(--border-soft);

    background: transparent;
    color: var(--text);
}

.user-card:last-child {
    border-bottom: 0;
}

.user-card:hover {
    background: rgba(255,255,255,0.012);
}

.user-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;

    display: grid;
    place-items: center;

    flex: 0 0 42px;

    border-radius: 11px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 75, 62, 0.22),
            rgba(191, 22, 16, 0.12)
        );

    border: 1px solid rgba(255, 75, 62, 0.22);

    color: #ff6a62;

    font-size: 14px;
    font-weight: 900;
}

.user-identity {
    min-width: 0;
}

.user-identity > strong {
    display: block;

    overflow: hidden;
    text-overflow: ellipsis;

    font-size: 13px;
}

.user-meta-row {
    margin-top: 6px;

    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 7px;
}

.status-pill {
    display: inline-flex;
    align-items: center;

    padding: 3px 7px;

    border-radius: 999px;

    font-size: 8px;
    font-weight: 850;

    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.status-pill.active {
    background: var(--green-soft);
    color: var(--green);
}

.status-pill.inactive {
    background: var(--accent-soft);
    color: #ff6a62;
}

.role-label {
    color: var(--muted);

    font-size: 9px;
    font-weight: 700;
}

.user-edit-grid {
    margin-top: 16px;

    display: grid;
    grid-template-columns:
        minmax(220px, 1.35fr)
        minmax(160px, 0.8fr)
        minmax(220px, 1.2fr)
        minmax(150px, 0.7fr);

    gap: 12px;
}

.form-field {
    min-width: 0;
}

.form-field > label {
    display: block;

    margin-bottom: 6px;

    color: var(--muted);

    font-size: 9px;
    font-weight: 800;

    text-transform: uppercase;
    letter-spacing: 0.65px;
}

.form-field input,
.form-field select {
    width: 100%;

    background: var(--bg-soft);
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 9px;

    padding: 10px 11px;

    outline: 0;

    font-size: 11px;
}

.form-field input::placeholder {
    color: #5e687b;
}

.form-field input:focus,
.form-field select:focus {
    border-color: #46516a;

    box-shadow:
        0 0 0 3px rgba(95, 140, 255, 0.07);
}

.toggle-field {
    display: flex;
    flex-direction: column;
}

.toggle-row {
    min-height: 39px;

    padding: 9px 10px;

    display: flex !important;
    align-items: center;

    gap: 8px;

    margin: 0 !important;

    background: var(--bg-soft);

    border: 1px solid var(--border);
    border-radius: 9px;

    color: var(--text) !important;

    text-transform: none !important;
    letter-spacing: 0 !important;

    cursor: pointer;
}

.toggle-row input {
    width: 14px;
    height: 14px;

    accent-color: var(--accent);

    cursor: pointer;
}

.toggle-row span {
    font-size: 10px;
    font-weight: 650;
}

.permission-preview {
    margin-top: 13px;

    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 6px;
}

.permission-preview span {
    padding: 5px 7px;

    background: var(--panel-3);

    border-radius: 6px;

    color: var(--muted);

    font-size: 8px;
}

.permission-preview .permission-preview-title {
    padding-left: 0;

    background: transparent;

    color: var(--muted-2);

    font-weight: 800;

    text-transform: uppercase;
    letter-spacing: 0.55px;
}

.user-card-actions {
    margin-top: 13px;

    display: flex;
    justify-content: flex-end;
}

.user-card-actions .secondary-btn {
    padding: 8px 13px;

    font-size: 9px;
    font-weight: 750;
}

.add-user-form {
    padding: 5px 20px 20px;

    display: grid;
    grid-template-columns:
        minmax(220px, 1.4fr)
        minmax(220px, 1fr)
        minmax(180px, 0.75fr)
        auto;

    gap: 12px;

    align-items: end;
}

.add-user-action {
    display: flex;
    align-items: flex-end;
}

.add-user-action .primary-btn {
    min-height: 39px;
    white-space: nowrap;
}

.role-guide {
    padding: 0 20px 20px;

    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    gap: 9px;
}

.role-guide-card {
    min-width: 0;

    padding: 12px;

    background: var(--bg-soft);

    border: 1px solid var(--border-soft);
    border-radius: 10px;
}

.role-guide-card strong {
    display: block;

    font-size: 10px;
}

.role-guide-card span {
    display: block;

    margin-top: 5px;

    color: var(--muted);

    font-size: 9px;
    line-height: 1.45;
}


/* USERS RESPONSIVE */

@media (max-width: 1150px) {

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

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

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

}


@media (max-width: 720px) {

    .users-stats-grid {
        grid-template-columns: 1fr;
    }

    .user-edit-grid,
    .add-user-form,
    .role-guide {
        grid-template-columns: 1fr;
    }

    .add-user-action {
        width: 100%;
    }

    .add-user-action .primary-btn {
        width: 100%;
    }

    .user-card {
        padding: 16px;
    }

    .user-card-actions {
        justify-content: stretch;
    }

    .user-card-actions .secondary-btn {
        width: 100%;
    }

}
