:root,
html[data-theme="dark"],
html[data-theme="light"] {
    --primary: #0ea5e9;
    --secondary: #0369a1;
    --accent: #0284c7;
    --primary-fg: #ffffff;
    --body-fg: #1f2937;
    --body-bg: #f5f7fb;
    --body-quiet-color: #64748b;
    --body-loud-color: #0f172a;
    --header-color: #ffffff;
    --header-branding-color: #ffffff;
    --header-bg: #0f172a;
    --header-link-color: #e0f2fe;
    --breadcrumbs-fg: #475569;
    --breadcrumbs-link-fg: #0369a1;
    --breadcrumbs-bg: #eaf6fd;
    --link-fg: #0369a1;
    --link-hover-color: #075985;
    --link-selected-fg: #0f172a;
    --hairline-color: #e2e8f0;
    --border-color: #d7dee8;
    --error-fg: #b91c1c;
    --message-success-bg: #dcfce7;
    --message-warning-bg: #fef3c7;
    --message-error-bg: #fee2e2;
    --darkened-bg: #eef3f8;
    --selected-bg: #e0f2fe;
    --selected-row: #eef8ff;
    --button-fg: #ffffff;
    --button-bg: #0ea5e9;
    --button-hover-bg: #0284c7;
    --default-button-bg: #0369a1;
    --default-button-hover-bg: #075985;
    --close-button-bg: #64748b;
    --close-button-hover-bg: #475569;
    color-scheme: light;
}

html,
body,
#container {
    background: #f5f7fb !important;
    color: #1f2937 !important;
}

#header {
    background: #0f172a !important;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
}

#branding h1,
#branding h1 a:link,
#branding h1 a:visited,
#user-tools,
#user-tools a,
#logout-form button {
    color: #ffffff !important;
}

#logout-form button:hover,
#user-tools a:hover {
    color: #bae6fd !important;
}

div.breadcrumbs {
    background: #eaf6fd !important;
    color: #475569 !important;
}

div.breadcrumbs a {
    color: #0369a1 !important;
}

#content h1,
#content h2,
#content h3,
#content h4,
.dashboard #content h2,
.change-list #content h1,
.change-form #content h1 {
    color: #0f172a !important;
}

.module,
.inline-group,
.submit-row,
#changelist,
#changelist-filter,
#toolbar,
.paginator,
.results,
fieldset.module,
.form-row,
.aligned label + p,
.selector-available,
.selector-chosen {
    background: #ffffff !important;
    color: #1f2937 !important;
}

.module,
.inline-group,
.submit-row,
#changelist,
#changelist-filter,
#toolbar {
    border: 1px solid #d7dee8 !important;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.module h2,
.module caption,
.inline-group h2,
#changelist-filter h2,
.selector .selector-available h2,
.selector .selector-chosen h2 {
    background: #eaf6fd !important;
    color: #0f172a !important;
}

.module h2 a,
.module caption a,
.inline-group h2 a,
#changelist-filter h2 a {
    color: #0f172a !important;
}

form .aligned p.help,
form .aligned div.help,
.help,
.quiet,
.mini,
.small {
    color: #64748b !important;
}

table thead th,
#result_list thead th,
#result_list tfoot td,
.inline-group .tabular tr.add-row td {
    background: #f8fafc !important;
    color: #0f172a !important;
}

table thead th a:link,
table thead th a:visited,
#result_list thead th a:link,
#result_list thead th a:visited {
    color: #0f172a !important;
}

#result_list tbody tr:nth-child(odd),
.row1 {
    background: #ffffff !important;
}

#result_list tbody tr:nth-child(even),
.row2 {
    background: #f8fafc !important;
}

#result_list tbody tr.selected,
#result_list tbody tr:hover {
    background: #eef8ff !important;
}

td,
th,
label,
legend,
.form-row label {
    color: #1f2937 !important;
}

a:link,
a:visited {
    color: #0369a1;
}

a:hover {
    color: #075985;
}

input,
select,
textarea,
.vTextField,
.vURLField,
.vIntegerField,
.vBigIntegerField,
.vForeignKeyRawIdAdminField,
.vDateField,
.vTimeField {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    color: #1f2937 !important;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #0ea5e9 !important;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14) !important;
    outline: none !important;
}

.button,
input[type="submit"],
input[type="button"],
.submit-row input,
a.button,
.object-tools a {
    background: #0ea5e9 !important;
    border-radius: 6px !important;
    color: #ffffff !important;
}

.button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.submit-row input:hover,
a.button:hover,
.object-tools a:hover {
    background: #0284c7 !important;
    color: #ffffff !important;
}

.submit-row input.default {
    background: #0369a1 !important;
}

.submit-row input.default:hover {
    background: #075985 !important;
}

.deletelink,
.submit-row a.deletelink {
    background: #ef4444 !important;
    color: #ffffff !important;
}

.deletelink:hover,
.submit-row a.deletelink:hover {
    background: #dc2626 !important;
}

ul.messagelist li {
    border-radius: 8px;
    color: #0f172a !important;
}

#changelist-filter a {
    color: #0369a1 !important;
}

#changelist-filter li.selected a {
    color: #0f172a !important;
    font-weight: 700;
}

.calendarbox,
.clockbox {
    background: #ffffff !important;
    color: #1f2937 !important;
}

.sv-admin-language-switch {
    align-items: center;
    display: inline-flex;
    gap: 6px;
    margin: 0 12px 0 0;
    vertical-align: middle;
}

.sv-admin-language-switch button {
    background: transparent !important;
    border: 0 !important;
    color: #e0f2fe !important;
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.sv-admin-language-switch button:hover,
.sv-admin-language-switch button.is-active {
    color: #ffffff !important;
    text-decoration: underline;
}

.sv-admin-language-switch span {
    color: #64748b;
}

.theme-toggle {
    display: none !important;
}

.sv-admin-dashboard #content {
    max-width: 1440px;
}

.sv-dashboard-hero {
    align-items: center;
    background: #ffffff;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 22px;
    padding: 24px;
}

.sv-dashboard-eyebrow {
    color: #0284c7;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.sv-dashboard-hero h1 {
    color: #0f172a !important;
    font-size: 30px;
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 8px;
}

.sv-dashboard-hero p:last-child {
    color: #64748b;
    font-size: 15px;
    margin: 0;
}

.sv-dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.sv-dashboard-actions a {
    background: #ffffff;
    border: 1px solid #0ea5e9;
    border-radius: 999px;
    color: #0369a1 !important;
    font-weight: 700;
    padding: 9px 15px;
    text-decoration: none;
}

.sv-dashboard-actions a.is-primary {
    background: #0ea5e9;
    color: #ffffff !important;
}

.sv-dashboard-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-bottom: 22px;
}

.sv-dashboard-card {
    background: #ffffff;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    color: #0f172a !important;
    display: block;
    min-height: 96px;
    padding: 18px;
    text-decoration: none;
}

.sv-dashboard-card:hover {
    border-color: #0ea5e9;
    box-shadow: 0 14px 30px rgba(14, 165, 233, 0.14);
}

.sv-dashboard-card span {
    color: #64748b;
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
}

.sv-dashboard-card strong {
    color: #0f172a;
    display: block;
    font-size: 30px;
    line-height: 1;
}

.sv-dashboard-layout {
    align-items: flex-start;
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(0, 1fr) 360px;
}

.sv-dashboard-apps,
.sv-dashboard-panel {
    background: #ffffff;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.sv-dashboard-apps h2,
.sv-dashboard-panel h2 {
    background: #eaf6fd !important;
    color: #0f172a !important;
    font-size: 15px;
    font-weight: 800;
    margin: 0;
    padding: 12px 16px;
}

.sv-dashboard-panel {
    margin-bottom: 18px;
}

.sv-dashboard-panel > p,
.sv-dashboard-panel .actionlist,
.sv-recent-cars {
    margin: 0;
    padding: 14px 16px;
}

.sv-recent-cars {
    list-style: none;
}

.sv-recent-cars li + li {
    border-top: 1px solid #e2e8f0;
}

.sv-recent-cars a {
    display: block;
    padding: 10px 0;
    text-decoration: none;
}

.sv-recent-cars strong {
    color: #0f172a;
    display: block;
    font-size: 14px;
}

.sv-recent-cars span,
.sv-recent-cars em {
    color: #64748b;
    display: block;
    font-size: 13px;
    font-style: normal;
    margin-top: 3px;
}

.sv-dashboard-apps .app-main,
.sv-dashboard-apps .app-auth,
.sv-dashboard-apps .app-news,
.sv-dashboard-apps .app-service,
.sv-dashboard-apps .app-easy_thumbnails {
    margin: 0;
}

@media (max-width: 1180px) {
    .sv-dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sv-dashboard-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .sv-dashboard-hero {
        align-items: stretch;
        display: block;
    }

    .sv-dashboard-actions {
        justify-content: flex-start;
        margin-top: 18px;
    }

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

    .sv-admin-language-switch {
        display: flex;
        margin: 8px 0;
    }
}

/* Final dashboard layout fixes */
.sv-admin-dashboard .main,
.sv-admin-dashboard main.content {
    display: block !important;
    width: 100% !important;
}

.sv-admin-dashboard #content {
    box-sizing: border-box;
    margin: 0 auto !important;
    max-width: 1480px !important;
    padding: 28px clamp(16px, 3vw, 36px) 48px !important;
    width: 100% !important;
}

.sv-admin-dashboard #content-main {
    float: none !important;
    width: auto !important;
}

.sv-admin-dashboard .sv-dashboard-hero {
    align-items: center;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(280px, auto);
    width: 100%;
}

.sv-dashboard-hero h1 {
    max-width: 720px;
    overflow-wrap: anywhere;
}

.sv-dashboard-actions {
    max-width: 520px;
}

.sv-dashboard-actions a {
    box-sizing: border-box;
    text-align: center;
    white-space: nowrap;
}

.sv-dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
    width: 100%;
}

.sv-dashboard-card {
    min-width: 0;
}

.sv-dashboard-card span,
.sv-dashboard-card strong {
    overflow-wrap: anywhere;
}

.sv-dashboard-layout {
    grid-template-columns: minmax(420px, 1fr) minmax(320px, 420px) !important;
    width: 100%;
}

.sv-dashboard-apps table {
    width: 100%;
}

#header {
    align-items: center;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    min-height: 58px;
    padding: 10px clamp(16px, 3vw, 38px) !important;
}

#branding {
    min-width: min(100%, 360px);
}

#site-name,
#site-name a {
    line-height: 1.25;
    white-space: normal;
}

#user-tools {
    align-items: center;
    display: flex !important;
    flex: 1 1 520px;
    flex-wrap: wrap;
    gap: 7px 10px;
    justify-content: flex-end;
    line-height: 1.4;
    text-align: right;
}

#user-tools a,
#logout-form,
#logout-form button,
.sv-admin-language-switch {
    display: inline-flex;
    margin: 0;
}

.sv-admin-language-switch {
    flex-wrap: wrap;
    gap: 5px;
}

@media (max-width: 980px) {
    .sv-admin-dashboard .sv-dashboard-hero {
        grid-template-columns: 1fr;
    }

    .sv-dashboard-actions {
        justify-content: flex-start;
        max-width: none;
    }

    .sv-dashboard-layout {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 640px) {
    #header {
        display: block;
    }

    #user-tools {
        display: flex !important;
        justify-content: flex-start;
        margin-top: 10px;
        text-align: left;
    }

    .sv-admin-dashboard #content {
        padding: 18px 12px 36px !important;
    }

    .sv-dashboard-hero {
        padding: 18px;
    }

    .sv-dashboard-hero h1 {
        font-size: 24px;
    }

    .sv-dashboard-actions a {
        width: 100%;
    }

    .sv-dashboard-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }

    .sv-dashboard-card {
        min-height: 86px;
        padding: 14px;
    }

    .sv-dashboard-card strong {
        font-size: 24px;
    }
}

@media (max-width: 420px) {
    .sv-dashboard-grid {
        grid-template-columns: 1fr !important;
    }
}
