*{ box-sizing:border-box }

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0f172a;
    color: #e5e7eb;
    line-height: 1.4;
    font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji","Segoe UI Emoji";

    /* Theme tokens for dark mode */
    --c-bg: #0f172a;
    --c-surface: #111827;
    --c-surface-alt: #0b1220;
    --c-border: #1f2937;
    --c-bg-input: #0a1220;
    --c-text-primary: #e5e7eb;
    --c-text-secondary: #7d7e81;
    --c-shadow-strong: 0 10px 25px rgba(0,0,0,.4);
}

header {
    position:sticky; top:0; z-index:10;
    background:linear-gradient(180deg, rgba(15,23,42,.85), rgba(15,23,42,.65));
    backdrop-filter:saturate(160%) blur(10px);
    border-bottom:1px solid #1f2937;
}

.header-logo-container h1 {
    margin:0;
    font-size:1.25rem;
    letter-spacing:.5px;
    color: #e5e7eb;
}

header > div, nav { 
    display:flex; 
    align-items:center; 
    gap:18px 
}

header > div {
    width: 100%;
    max-width: none;
    padding: 14px 20px;
    margin-left: 0;
    margin-right: 0;
    justify-content:space-between; 
    margin:0 auto 
}

nav { 
    display: flex; 
    align-items: center; 
}

nav ul { 
    display:flex;
    align-items: center;
    gap:14px; 
    list-style:none; 
    margin:0; 
    padding:0 
}

nav li { 
    display:flex;
    align-items:center; 
}

nav form { 
    margin:0; 
}

nav a { 
    color: #94a3b8; 
    text-decoration:none; 
    padding:8px 12px; 
    border-radius:10px 
}

nav a:hover { 
    color: #e5e7eb; 
    background:rgba(148,163,184,.12) 
}

nav button {
    background: transparent;
    color: #94a3b8;
    border: 0;
    padding: 8px 12px;
    border-radius: 10px;
    font: inherit; 
    line-height: 1;
    cursor: pointer;
}

nav button:hover {
    color: #e5e7eb;
    background: rgba(148,163,184,.12);
}

.auth-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 2rem;
}

.auth-card {
    background: linear-gradient(180deg, rgba(56,189,248,.06), rgba(56,189,248,0) 40%), #111827;
    border: 1px solid #1f2937;
    border-radius: 18px;
    box-shadow: 0 10px 25px rgba(0,0,0,.4);
    padding: 2rem 2.5rem;
    width: 100%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    text-align: center;
}

.auth-card h1 {
    margin-bottom: 1rem;
    font-size: 1.6rem;
    color: #f1f5f9;
}

.auth-card label {
    display: block;
    text-align: left;
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 9px;
}

.auth-card input[type="text"],
.auth-card input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #1f2937;
    background: #0a1220;
    color: #e5e7eb;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.auth-card input:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px rgba(56,189,248,.12);
    outline: none;
}

.auth-card .full-width {
    width: 100%;
    padding: 10px 0;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
}

.auth-footer {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #94a3b8;
}

.auth-footer a {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.page-header h1, h1, h2, h3 { 
    margin:.2rem 0 1rem 
}

hr { 
    border:0; 
    height:1px; 
    background:linear-gradient(90deg, transparent, #1f2937, transparent); 
    margin:24px 0 
}

.navbar-btn a,
.navbar-btn button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    font-weight: 500;
    color: #94a3b8;
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.navbar-btn a:hover,
.navbar-btn button:hover {
    color: #e5e7eb;
    background: rgba(148,163,184,.12);
    text-decoration: none;
}

.inventory-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inventory-action-btn .btn-primary,
.inventory-action-btn a.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 18px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    background: linear-gradient(180deg, #22d3ee, #38bdf8);
    color: #001018;
    text-decoration: none;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.inventory-action-btn .btn-primary:hover,
.inventory-action-btn a.btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    text-decoration: none;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.search-actions select {
    width: auto;
    min-width: 120px;
    height: 42px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-family: inherit;
    font-size: 12;
    border-radius: 12px;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    line-height: 1.2;
}

.btn:hover { 
    background:rgba(148,163,184,.18);
}

.btn-primary { 
    background:linear-gradient(180deg, #22d3ee, #38bdf8); 
    color:#001018;
}

.btn-primary:hover { 
    filter:brightness(1.05);
}

.btn-secondary { 
    background:transparent; 
    color: #38bdf8; 
    border-color:rgba(56,189,248,.35);
}

.btn-secondary:hover { 
    background:rgba(56,189,248,.08);
}

.btn-delete { 
    background:transparent; 
    color: #ef4444; 
    border-color:rgba(239,68,68,.35);
}

.btn-delete:hover { 
    background:rgba(239,68,68,.08);
}

button:active, .btn:active { 
    transform:translateY(1px);
}

.edit-btn {
    background: linear-gradient(180deg, #22d3ee, #38bdf8);
    color: #001018;
    box-shadow: 0 2px 8px rgba(56,189,248,0.3);
}

.edit-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56,189,248,0.4);
}

.delete-btn {
    background: linear-gradient(180deg, rgba(239,68,68,0.9), rgba(220,38,38,0.9));
    color: #fff;
    box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}
.delete-btn:hover {
    background: linear-gradient(180deg, rgba(239,68,68,1), rgba(185,28,28,1));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239,68,68,0.4);
}

form { 
    display:grid;
    gap:16px;
}

input, select, textarea {
    width:100%; 
    background:#0a1220; 
    color: #e5e7eb;
    border:1px solid #1f2937; 
    border-radius:12px;
    padding:10px 12px;
    outline:none;
}

input:focus, select:focus, textarea:focus { 
    border-color: #38bdf8; 
    box-shadow:0 0 0 4px rgba(56,189,248,.12) 
}

fieldset { 
    border:1px solid #1f2937; 
    border-radius:16px;
    padding:14px 16px; 
    background: #0b1220;
}

legend { 
    padding:0 8px; 
    color: #94a3b8; 
}

.messages { 
    list-style:none; 
    padding:0; 
    margin:0 0 16px; 
    display:grid; 
    gap:10px 
}

.messages li { 
    background: #0b1220; 
    border:1px solid #1f2937; 
    padding:10px 12px; 
    border-radius:12px;
}

.messages li.success { 
    border-color:rgba(34,197,94,.35); 
}

.messages li.error { 
    border-color:rgba(239,68,68,.35); 
}

.card-form-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: nowrap;
    margin-bottom: 32px;
}

.card-form-container > input[type="text"] {
    flex: 1;
    height: 42px;
    padding: 0 12px;
    border-radius: 12px;
}

.card-form-container > div {
    display:flex; 
    gap:10px; 
    align-items:center;
    flex-wrap: wrap;
}

.card-form-container select {
    appearance: none;
    background-repeat: no-repeat;
    background: #0a1220;
    color: #e5e7eb;
    border: 1px solid #1f2937;
    border-radius: 12px;
    padding: 10px 36px 10px 12px;
    line-height: 1;
    cursor: pointer;
}

.card-form-container select:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px rgba(56,189,248,.12);
    outline: none;
}

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: all .2s ease;
}

.card-link:hover {
    text-decoration: none;
    background:linear-gradient(180deg, rgba(56,189,248,.15), rgba(56,189,248,0) 35%), #111827;
    border-color: #38bdf8;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,.45);
}

.card-link h3 a {
    color: inherit;
    text-decoration: none;
}

.cards { 
    display:grid; 
    grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); 
    gap:16px;
}

.card {
    background:linear-gradient(180deg, rgba(56,189,248,.08), rgba(56,189,248,0) 35%), #111827;
    border:1px solid #1f2937; 
    width: 100%;
    max-width: 520px;
    border-radius: 16px;
    padding:16px;
    box-shadow: 0 8px 20px rgba(0,0,0,.35);
}

.card h3 { 
    margin:.2rem 0 .6rem; 
    font-size:1.05rem 
}

.card .meta { 
    color: #94a3b8; 
    font-size:.95rem 
}

.car-meta {
    background: #0b1220; 
    border:1px solid #1f2937;
    border-radius: 16px;
    padding:14px 16px; 
    margin:10px 0 18px;
}

.status-available { 
    color: #22c55e; 
}

.status-pending { 
    color: #f59e0b;
}

.status-sold { 
    color: #ef4444;
}

.car-photos-grid {
    display:grid; 
    grid-template-columns:repeat(auto-fill, minmax(180px, 1fr)); 
    gap:14px;
}

.photo-item {
    background: #111827; 
    border:1px solid #1f2937; 
    border-radius:14px; 
    padding:8px;
}

.photo-item img { 
    width:100%; 
    height:150px; 
    object-fit:cover; 
    border-radius:10px 
}

.photo-item figcaption { 
    color: #94a3b8; 
    margin-top:6px; 
    font-size:.9rem 
}

a { 
    color: #38bdf8;
}

a:hover { 
    text-decoration:underline 
}

.mt-4 { 
    margin-top:1rem 
}

.action-links { 
    display:flex; 
    gap:10px; 
    margin:8px 0 18px 
}

.profile-card, .profile-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 1rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #1f2937;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.profile-avatar.placeholder {
    color: #94a3b8;
}

.profile-info h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #e5e7eb;
}

.profile-info .dealership {
    color: #94a3b8;
    margin-top: 2px;
    font-size: 0.95rem;
}

.profile-body {
    color: #e5e7eb;
}

.profile-body .bio {
    margin-top: .5rem;
    margin-bottom: 1rem;
    white-space: pre-line;
}

.profile-body .no-bio {
    color: #94a3b8;
    font-style: italic;
}

.profile-body .meta {
    color: #94a3b8;
    font-size: 0.95rem;
}

.car-detail-container {
    max-width: 1100px;
    margin: 40px auto;
    background: linear-gradient(180deg, rgba(56,189,248,.05), rgba(56,189,248,0) 35%), #0f172a;
    border: 1px solid #1f2937;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0,0,0,.35);
}

.car-header {
    margin-bottom: 18px;
}

.car-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    color: #e5e7eb;
}

.car-header .vin {
    color: #94a3b8;
    font-size: 0.95rem;
}

.car-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.car-meta .meta-item {
    background: #0b1220;
    border: 1px solid #1f2937;
    padding: 10px 14px;
    border-radius: 12px;
    color: #e5e7eb;
    font-size: 0.95rem;
}

.car-meta .meta-item span {
    color: #94a3b8;
    font-weight: 500;
    margin-right: 4px;
}

.divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #1f2937, transparent);
    margin: 24px 0;
}

.action-links {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 20px, 0;
}

.inline-form {
    display: inline;
}

.status {
    font-weight: 600;
}
.status-available { 
    color: #22c55e; 
}

.status-pending { 
    color: #f59e0b; 
}

.status-sold { 
    color: #ef4444; 
}

.photo-item {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,.25);
    transition: transform .2s ease, box-shadow .2s ease;
}

.photo-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,.4);
}

.photo-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
}

.photo-item figcaption {
    color: #94a3b8;
    margin-top: 6px;
    font-size: .9rem;
    text-align: center;
}

.xrow { 
    margin-bottom: 14px; 
}

.xrow .xlabel {
    display: inline-block;
    margin-bottom: 6px;
    color: #cbd5e1;
    font-weight: 600;
    letter-spacing: .2px;
}

.xreq { 
    color: #f87171; 
    margin-left: 4px; 
}

.xhelp { 
    color: #94a3b8; 
    font-size: .9rem; 
}

.xerror {
    margin-top: 6px;
    color: #fecaca;
    background: rgba(239,68,68,.06);
    border: 1px solid rgba(239,68,68,.25);
    padding: 8px 10px;
    border-radius: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.form-grid .xrow:nth-child(1) { 
    grid-column: 1 / -1; 
}

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

.xcheck-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  background: #0a1220;
  border: 1px solid #1f2937;
  border-radius: 12px;
}

.xcheck-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #38bdf8;
    cursor: pointer;
    border-radius: 4px;
}

.xcheck-label {
    color: #e5e7eb;
    font-weight: 500;
}

.xrow--checkbox .xhelp { 
    margin-left: 6px; 
}

.photo-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.btn-sm {
    height: 28px;
    padding: 0 10px;
    font-size: .85rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
}

.car-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 10px;
}

.car-photos-grid .photo-item { 
    margin: 0;
    background: #0b1220;
    border: 1px solid #1f2937;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 8px 18px rgba(0,0,0,.25);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.car-photos-grid .photo-item:hover {
    transform: translateY(-2px);
    border-color: #38bdf8;
    box-shadow: 0 14px 30px rgba(0,0,0,.35);
}

.car-photos-grid .photo-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
}

.car-photos-grid .photo-item figcaption {
    color: #94a3b8;
    margin-top: 6px;
    font-size: .92rem;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}

.car-photos-grid .photo-item .photo-actions,
.car-photos-grid .photo-item p {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 10px 0 0;
}

.car-photos-grid .photo-item a,
.car-photos-grid .photo-item button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: .86rem;
    text-decoration: none;
    border: 0;
    cursor: pointer;
}

.car-photos-grid .photo-item a { 
    background: linear-gradient(180deg,#22d3ee,#38bdf8);
    color:#001018;
}
.car-photos-grid .photo-item a:hover { 
    filter: brightness(1.05); 
}

.car-photos-grid .photo-item button {
    background: linear-gradient(180deg, rgba(239,68,68,.9), rgba(185,28,28,1));
    color: #fff;
}
.car-photos-grid .photo-item button:hover { 
    filter: brightness(1.05); 
}

.form-card {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 30px;
    background: linear-gradient(180deg, rgba(56,189,248,.06), rgba(56,189,248,0) 40%), #111827;
    border: 1px solid #1f2937;
    border-radius: 18px;
    box-shadow: 0 10px 25px rgba(0,0,0,.4);
    padding: 24px 28px;
}

.form-card img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 15px rgba(0,0,0,.3);
}

form[action*="import_api"] {
    display: flex;
    justify-content: center;
}

form[action*="import_api"] .btn-primary {
    width: 100%;
    max-width: 600px;
    border-radius: 12px;
    height: 46px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(180deg, #22d3ee, #38bdf8);
    color: #001018;
    transition: all 0.2s ease;
}

form[action*="import_api"] .btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

a.btn,
.btn,
a.btn:hover,
.btn:hover {
    text-decoration: none !important;
}

.form-alert.error {
    color: #fecaca;
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.25);
    padding: 10px 12px;
    border-radius: 10px;
    text-align: left;
}

.field-error {
    color: #fecaca;
    background: rgba(239,68,68,.06);
    border: 1px solid rgba(239,68,68,.25);
    padding: 8px 10px;
    border-radius: 10px;
    margin-top: 8px;
}

.help-list {
    margin: 6px 0 12px;
    padding-left: 18px;
    color: #94a3b8;
    font-size: 0.9rem;
}

.help-list li { 
    margin: 4px 0; 
}

.help { 
    color: #94a3b8; 
}

.car-owner {
    margin-top: 6px;
    color: #94a3b8;
    font-size: 0.95rem;
}

.car-owner .profile-link {
    color: #38bdf8;
    font-weight: 600;
    text-decoration: none;
    transition: color .2s ease, text-shadow .2s ease;
}

.car-owner .profile-link:hover {
    color: #7dd3fc;
    text-shadow: 0 0 6px rgba(56,189,248,0.5);
}

@media (max-width: 700px) {
    .card-form-container { 
        flex-direction: column; 
        align-items: stretch; 
    }
    .search-actions { 
        justify-content: space-between; 
    }
}

/* --- Inventory Card Image Styles --- */

.card-image-container {
    position: relative;
    width: calc(100% + 32px); 
    margin-left: -16px; 
    margin-top: -16px; 
    margin-bottom: 16px;
    padding-top: 66%; 
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    overflow: hidden; 
}

.card-car-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

.no-images-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--c-bg-input); 
    color: var(--c-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-style: italic;
    border-radius: inherit;
}

/* --- Next Button Styling --- */

.card-next-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4); 
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    transition: background 0.2s ease;
}

.card-next-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.light-mode .card-next-btn {
    background: rgba(255, 255, 255, 0.7);
    color: var(--c-text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.light-mode .card-next-btn:hover {
    background: rgba(255, 255, 255, 1);
}

/* --- Back Button Styling --- */

.card-back-btn {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4); 
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 5;
    transition: background 0.2s ease;
}

.card-back-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.light-mode .card-back-btn {
    background: rgba(255, 255, 255, 0.7);
    color: var(--c-text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.light-mode .card-back-btn:hover {
    background: rgba(255, 255, 255, 1);
}

/* --- Light Mode --- */

body.light-mode {
    background: #f3f4f6;
    color: #0f172a;

    --c-bg: #f3f4f6;
    --c-surface: #ffffff;
    --c-surface-alt: #f9fafb;
    --c-border: #e5e7eb;
    --c-bg-input: #f9fafb;
    --c-text-primary: #0f172a;
    --c-text-secondary: #6b7280;
    --c-shadow-strong: 0 10px 25px rgba(15,23,42,.08);
}

/* Header & nav */

body.light-mode .header-logo-container h1 {
    color: #0f172a;
}

body.light-mode nav a,
body.light-mode nav button,
body.light-mode .navbar-btn a,
body.light-mode .navbar-btn button {
    color: #4b5563;
}

body.light-mode nav a:hover,
body.light-mode nav button:hover,
body.light-mode .navbar-btn a:hover,
body.light-mode .navbar-btn button:hover {
    color: #0f172a;
    background: rgba(148,163,184,.14);
    text-decoration: none;
}

/* Generic text */

body.light-mode,
body.light-mode p,
body.light-mode li,
body.light-mode label,
body.light-mode .profile-body {
    color: var(--c-text-primary);
}

body.light-mode h1,
body.light-mode h2,
body.light-mode h3,
body.light-mode .page-header h1,
body.light-mode .profile-info h2,
body.light-mode .car-header h2,
body.light-mode .xrow .xlabel {
    color: var(--c-text-primary);
}

body.light-mode .meta,
body.light-mode .help,
body.light-mode .help-list,
body.light-mode .car-owner,
body.light-mode .xhelp,
body.light-mode .profile-info .dealership,
body.light-mode .profile-body .no-bio {
    color: var(--c-text-secondary);
    text-decoration: none;
}

/* Horizontal rule */

body.light-mode hr,
body.light-mode .divider {
    background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
}

/* Cards / panels / surfaces */

body.light-mode .auth-card,
body.light-mode .card,
body.light-mode .form-card,
body.light-mode .car-detail-container,
body.light-mode fieldset,
body.light-mode .messages li,
body.light-mode .car-meta .meta-item,
body.light-mode .profile-card,
body.light-mode .profile-form {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 22px;
    border: 1px solid rgba(209, 213, 219, 0.7);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.12),
        0 2px 8px rgba(15, 23, 42, 0.04);
}

body.light-mode .car-meta,
body.light-mode .car-photos-grid .photo-item,
body.light-mode .photo-item {
    background: var(--c-surface-alt);
    border-color: var(--c-border);
}

/* Forms */

body.light-mode input,
body.light-mode select,
body.light-mode textarea,
body.light-mode .xcheck-inline {
    background: var(--c-bg-input);
    color: var(--c-text-primary);
    border-color: var(--c-border);
    text-decoration: none;
}

body.light-mode input::placeholder,
body.light-mode textarea::placeholder {
    color: #9ca3af;
}

body.light-mode .xcheck-label {
    color: var(--c-text-primary);
}

/* Messages / errors */

body.light-mode .messages li {
    background: #ffffff;
}

body.light-mode .messages li.success {
    border-color: rgba(34,197,94,.35);
    background: #ecfdf3;
}

body.light-mode .messages li.error,
body.light-mode .form-alert.error,
body.light-mode .field-error,
body.light-mode .xerror {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

/* Card links & hover */

body.light-mode .card-link:hover {
    background: linear-gradient(180deg, rgba(56,189,248,.10), rgba(56,189,248,0) 35%), #ffffff;
    border-color: #95a5aca7;
    box-shadow: 0 10px 25px #8ba9b6a4;
    text-decoration: none;
}

/* Inventory card image placeholder */

body.light-mode .no-images-placeholder {
    background: var(--c-bg-input);
    color: var(--c-text-secondary);
}

/* Profile avatar */

body.light-mode .profile-avatar {
    border-color: var(--c-border);
    background: var(--c-surface-alt);
}

body.light-mode .car-photos-grid .photo-item {
    box-shadow: 0 8px 18px rgba(15,23,42,.06);
}

body.light-mode .car-photos-grid .photo-item:hover {
    box-shadow: 0 14px 30px rgba(15,23,42,.08);
}

/* Links */

body.light-mode a {
    color: #0284c7;
}

body.light-mode a:hover {
    text-decoration: underline;
}

/* Auth section */

body.light-mode .auth-section {
    background: transparent;
}

body.light-mode .auth-card {
    background: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

body.light-mode .auth-card input[type="text"],
body.light-mode .auth-card input[type="password"],
body.light-mode .auth-card input,
body.light-mode .auth-card select,
body.light-mode .auth-card textarea {
    background: #ffffff !important;
    color: #0f172a;
    border: 1px solid #d1d5db;
}

body.light-mode .auth-card input:focus,
body.light-mode .auth-card textarea:focus {
    border-color: #38bff8bf;
    box-shadow: 0 0 0 4px rgba(56,189,248,.20);
}

body.light-mode .auth-card label {
    color: #374151;
}

body.light-mode .help-list li,
body.light-mode .help,
body.light-mode .auth-footer {
    color: #6b7280;
}

body.light-mode header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(248, 250, 252, 0.75);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        0 0.5px 0 rgba(15, 23, 42, 0.06),
        0 10px 25px rgba(15, 23, 42, 0.04);
}

body.light-mode .header-logo-container h1 {
    color: #0f172a;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
}

body.light-mode .navbar-btn a,
body.light-mode .navbar-btn button {
    color: #111827;
    font-weight: 500;
    background: transparent;
    padding: 8px 14px;
    border-radius: 999px;
    border: 0;
    box-shadow: none;
    transition:
        background 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.12s ease;
}

body.light-mode .navbar-btn a:hover,
body.light-mode .navbar-btn button:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
    text-decoration: none;
}

body.light-mode #theme-toggle {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(209, 213, 219, 0.9);
    border-radius: 999px;
    padding: 8px 16px;
    color: #0f172a;
    font-weight: 500;
}

body.light-mode #theme-toggle:hover {
    background: #ffffff;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.16);
}

body.light-mode {
    background: linear-gradient(
        180deg,
        #fafbfd 0%,
        #f5f7fa 30%,
        #f3f5f8 100%
    );
}

body.light-mode .card {
    border-radius: 20px;
}

body.light-mode .card-image-container {
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

body.light-mode hr,
body.light-mode .divider {
    height: 1px;
    margin: 24px 0;
    border: 0;
    background: linear-gradient(
        90deg,
        rgba(148, 163, 184, 0),
        rgba(148, 163, 184, 0.4),
        rgba(148, 163, 184, 0)
    );
    opacity: 0.7;
}

/* segment-control */

.segmented-control {
    display: inline-flex;
    padding: 3px;
    gap: 3px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}

.segment-button {
    position: relative;
    border: 0;
    background: transparent;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    color: #e5e7eb;
    transition:
        background 0.18s ease,
        box-shadow 0.18s ease,
        color 0.18s ease,
        transform 0.12s ease;
}

.segment-button.is-active {
    background: #ffffff;
    color: #0f172a;
    box-shadow:
        0 4px 8px rgba(15, 23, 42, 0.18),
        0 0 0 1px rgba(148, 163, 184, 0.35);
    transform: translateY(-1px);
}

.segment-button:not(.is-active):hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Light mode tweaks */
body.light-mode .segmented-control {
    background: rgba(148, 163, 184, 0.1);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.35);
}

body.light-mode .segment-button {
    color: #4b5563;
}

body.light-mode .segment-button.is-active {
    background: #ffffff;
    color: #0f172a;
    box-shadow:
        0 4px 10px rgba(15, 23, 42, 0.15),
        0 0 0 1px rgba(209, 213, 219, 0.9);
}

/* Inventory layout with sidebar */

.layout-sidebar {
    display: grid;
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.filters-sidebar {
    position: sticky;
    top: 82px;
}

.filters-form {
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid #1f2937;
    background: #111827;
    box-shadow: 0 18px 40px rgba(0,0,0,0.55),
                0 2px 6px rgba(0,0,0,0.7);
    display: grid;
    gap: 14px;
}

.filters-form .full-width {
    width: 100%;
    display: inline-flex;
    justify-content: center;
}

.filters-form h2 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
}

.filters-form .filter-label input {
    border-radius: 999px;
    height: 40px;
}

.filters-form .filter-label .segmented-control {
    width: 100%;
    justify-content: space-between;
    padding: 3px;
    gap: 8px;
}

.filters-form .filter-label .segment-button {
    flex: 1;
    text-align: center;
    padding: 8px 14px;
    font-size: 0.82rem;
    white-space: nowrap;
    box-sizing: border-box;
}

.filters-form .btn.full-width,
.filters-form .btn-primary.full-width {
    border-radius: 999px;
    height: 40px;
    font-size: 0.9rem;
}

.filters-form button.btn-primary.full-width {
    box-shadow:
        0 3px 8px rgba(15, 23, 42, 0.10);
}

.filters-form a.btn-primary.full-width {
    margin-top: 4px;
}

.filters-form .segmented-control {
    padding: 4px;
    gap: 6px;
}

.filters-form .segment-button {
    background: rgba(0,0,0,0.04);
    border: none;
    font-weight: 500;
    transition: all .2s ease;
}

.filters-form .segment-button.is-active {
    background: #22d3ee;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: #080808bf;
}

.filter-label {
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
    color: #e5e7eb;
}

body.light-mode .filter-label {
    color: #4b5563;
}

body.light-mode .filters-form {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(209, 213, 219, 0.7);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.12),
        0 2px 6px rgba(15, 23, 42, 0.04);
}

@media (max-width: 900px) {
    .layout-sidebar {
        grid-template-columns: minmax(0, 1fr);
    }

    .filters-sidebar {
        position: static;
        order: -1;
    }
    .auth-card {
        max-width: 560px;
    }
}

/* Apple-style toggle switch */

.switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.switch input {
    display: none;
}

.switch-track {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #e5e7eb;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.7);
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow:
        0 2px 4px rgba(15, 23, 42, 0.25),
        0 0 0 0 rgba(56, 189, 248, 0);
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.switch input:checked + .switch-track {
    background: linear-gradient(135deg, #22d3ee, #38bdf8);
    box-shadow:
        0 0 0 1px rgba(59, 130, 246, 0.4),
        0 4px 10px rgba(37, 99, 235, 0.35);
}

.switch input:checked + .switch-track .switch-thumb {
    transform: translateX(20px);
    box-shadow:
        0 3px 6px rgba(15, 23, 42, 0.35),
        0 0 0 2px rgba(191, 219, 254, 0.95);
}

.switch-label {
    font-size: 0.9rem;
    color: #4b5563;
}

body:not(.light-mode) .switch-label {
    color: #e5e7eb;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-family: inherit;
    font-size: 12;
    border-radius: 12px;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    line-height: 1.2;
}

.btn-primary { 
    background:linear-gradient(180deg, #22d3ee, #38bdf8); 
    color:#001018;
}

.container {
    width: min(1620px, 100% - 48px);
    margin: 32px auto;
    padding: 0 0 24px;
}

.content-main {
    padding-top: 4px;
}

.theme-toggle-btn {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 12px;
    transition: background 0.2s ease;
}

.light-mode .theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.07);
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid #1f2937;
    padding: 14px 0 22px;
    font-size: 0.9rem;
    color: var(--c-text-secondary);
    background: radial-gradient(circle at top, rgba(15,23,42,0.9), #020617);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.footer-copy {
    margin: 0;
}

.footer-contact {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-contact span {
    color: var(--c-text-secondary);
}

.footer-contact a {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 500;
}

.footer-contact a:hover {
    text-decoration: underline;
}

body.light-mode .site-footer {
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

body.light-mode .footer-copy,
body.light-mode .footer-contact span {
    color: var(--c-text-secondary);
}

body.light-mode .footer-contact a {
    color: #0284c7;
}

main.container {
    flex: 1 0 auto;
}

@media (max-width: 600px) {
    header nav ul.navbar-btn li a,
    header nav ul.navbar-btn li button {
        font-size: 0.8rem;
        padding: 0.25rem 0.4rem;
    }

    header nav ul.navbar-btn {
        gap: 0.5rem;
    }

    header nav ul.navbar-btn {
        flex-wrap: wrap;
    }
}

/* --- Mobile navbar dropdown --- */

.nav-mobile-toggle {
    display: none;
    background: transparent;
    border: 0;
    color: #e5e7eb;
    font-size: 1.3rem;
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
}

.nav-mobile-toggle:hover {
    background: rgba(255,255,255,0.08);
}

body.light-mode .nav-mobile-toggle {
    color: #111827;
}

body.light-mode .nav-mobile-toggle:hover {
    background: rgba(0,0,0,0.06);
}

@media (max-width: 700px) {
    header > div {
        padding: 10px 14px;
    }

    nav {
        width: 100%;
        justify-content: flex-end;
        position: relative;
    }

    .nav-mobile-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
    }

    .navbar-btn {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        margin-top: 8px;
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        border-radius: 14px;
        background: rgba(15,23,42,0.98);
        border: 1px solid #1f2937;
        box-shadow: 0 18px 30px rgba(0,0,0,0.6);
        display: none;
    }

    body.light-mode .navbar-btn {
        background: #ffffff;
        border-color: #e5e7eb;
        box-shadow: 0 12px 30px rgba(15,23,42,0.16);
    }

    .navbar-btn li {
        width: 100%;
    }

    .navbar-btn a,
    .navbar-btn button {
        width: 100%;
        justify-content: flex-start;
        padding: 8px 10px;
    }

    .navbar-btn.nav-open {
        display: flex;
    }
}
