:root {
    --primary-color: #2563eb;
    --bg-color: #f8fafc;
    --nav-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --header-height: calc(60px + env(safe-area-inset-top, 0px));
    --footer-height: 0px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: -webkit-fill-available; /* Fix for iOS safari 100vh bug */
    height: 100dvh;
    overflow: hidden;
}

body.dark-mode {
    --bg-color: #111827;
    --nav-bg: #18212e;
    --text-color: #f1f5f9;
    --text-muted: #aab6c5;
    --primary-color: #93c5fd;
}

body.dark-mode .app-content {
    background-image: none;
}

body.dark-mode .app-header,
body.dark-mode .app-nav {
    border-color: #334155;
}

body.dark-mode .brand-lockup {
    color: var(--text-color);
}

body.dark-mode .logo-container img,
body.dark-mode .mobile-center-jpg {
    filter: invert(1);
    mix-blend-mode: screen;
}

/* Header Styles */
.app-header {
    height: var(--header-height);
    background-color: var(--nav-bg);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: env(safe-area-inset-top, 0px) 16px 0;
}

.brand-lockup {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #111111;
    font-size: 20px;
    font-weight: 800;
    white-space: nowrap;
}

.logo-container {
    width: 52px;
    height: 40px;
    overflow: hidden;
    flex: 0 0 auto;
}

.logo-container img {
    width: 52px;
    height: 40px;
    display: block;
    object-fit: contain;
}

@media (max-width: 400px) {
    .brand-lockup {
        gap: 3px;
        font-size: 18px;
    }

    .logo-container {
        width: 44px;
        height: 34px;
    }

    .logo-container img {
        width: 44px;
        height: 34px;
    }

}

/* Update your app-content container to hold the background */
.app-content {
    margin-top: var(--header-height);
    margin-bottom: var(--footer-height);
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
}


/* Header icon navigation */
.header-nav {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 2px;
}

.header-nav-right {
    justify-content: flex-end;
}

.header-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

button.header-icon {
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

button.header-icon[hidden] {
    display: none;
}

.header-icon.active {
    color: var(--primary-color);
}

.header-icon svg {
    width: 36px;
    height: 36px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 400px) {
    .header-icon {
        width: 42px;
        height: 42px;
    }

    .header-icon svg {
        width: 32px;
        height: 32px;
    }
}

/* Bottom Navigation Styles (no longer rendered) */
.app-nav {
    height: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px));
    background-color: var(--nav-bg);
    border-top: 1px solid #e2e8f0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom); /* Support for notch phones */
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    height: 100%;
    transition: color 0.2s ease;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Minimal pure CSS icons placeholder - swap with SVG or Icon fonts later */
.nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    background-color: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

/* Fallback simple visual block for demo */
.nav-icon-fallback {
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-radius: 4px;
    margin-bottom: 3px;
}

.responsive-phone-jpg {
    width: 100%;             /* Stretches the image to match the phone width */
    max-width: 100%;         /* Prevents it from scaling wider than its parent container */
    height: auto;            /* Keeps the original aspect ratio so it doesn't look stretched */
    border-radius: 8px;      /* Optional: gives it a clean, modern app-like rounded edge */
    display: block;
    object-fit: cover;       /* Ensures crisp cropping adjustments across various phone heights */
}
 
/* 1. Make the content section a flex container to perfectly center items */
.centered-image-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - var(--footer-height) - 32px); /* Fills available viewport space */
    width: 100%;
    padding: 16px;
    box-sizing: border-box;
}

/* 2. Constrain and auto-resize the high-res JPG asset */
.mobile-center-jpg {
    width: 100%;             /* Allow it to scale up to the width of the screen padding */
    max-width: 320px;        /* Restricts max width so it doesn't look overly massive on wide phones/tablets */
    height: auto;            /* Keeps the original aspect ratio so it doesn't warp or look squished */
    display: block;
    margin: 0 auto;          /* Secondary safety centering rule */
    object-fit: contain;     /* Ensures no parts of the logo are cropped or clipped */
}

.profile-settings {
    max-width: 560px;
    margin: 24px auto;
    color: var(--text-color);
}

.profile-settings h1 {
    margin-bottom: 20px;
    font-size: 24px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
    cursor: pointer;
}

.setting-row span {
    display: grid;
    gap: 4px;
}

.setting-row small {
    color: var(--text-muted);
}

.setting-row input {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    accent-color: var(--primary-color);
}

.save-preferences {
    margin-top: 16px;
    padding: 10px 16px;
    border: 0;
    border-radius: 6px;
    background: var(--primary-color);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.profile-logout {
    display: inline-block;
    margin-top: 24px;
    padding: 9px 14px;
    border: 1px solid #b91c1c;
    border-radius: 6px;
    color: #b91c1c;
    font-weight: 700;
    text-decoration: none;
}

body.dark-mode .setting-row {
    border-color: #334155;
}

body.dark-mode .save-preferences {
    color: #0f172a;
}

body.dark-mode .profile-logout {
    border-color: #fca5a5;
    color: #fca5a5;
}

.assets-page {
    max-width: 760px;
    margin: 24px auto;
    color: var(--text-color);
}

.assets-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.assets-heading h1 {
    font-size: 24px;
}

.assets-heading p,
.asset-count {
    margin-top: 5px;
    color: var(--text-muted);
}

.asset-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding-bottom: 20px;
    border-bottom: 1px solid #cbd5e1;
}

.asset-form label {
    display: grid;
    gap: 6px;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 600;
}

.asset-form input,
.asset-form select,
.asset-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    color: #1e293b;
    font: inherit;
}

.asset-notes,
.asset-form button,
.asset-form .form-error {
    grid-column: 1 / -1;
}

.asset-form textarea {
    resize: vertical;
}

.asset-form button {
    justify-self: start;
    padding: 10px 16px;
    border: 0;
    border-radius: 4px;
    background: var(--primary-color);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.form-error {
    color: #b91c1c;
}

.asset-list {
    margin-top: 8px;
}

.asset-row {
    padding: 16px 0;
    border-bottom: 1px solid #cbd5e1;
}

.asset-row header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.asset-row h2 {
    font-size: 17px;
}

.asset-row p,
.asset-category,
.asset-empty {
    margin-top: 6px;
    color: var(--text-muted);
}

body.dark-mode .asset-form {
    border-color: #334155;
}

body.dark-mode .asset-form input,
body.dark-mode .asset-form select,
body.dark-mode .asset-form textarea {
    border-color: #475569;
    background: #18212e;
    color: #f1f5f9;
}

body.dark-mode .asset-row {
    border-color: #334155;
}

body.dark-mode .form-error {
    color: #fca5a5;
}

@media (max-width: 520px) {
    .asset-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .asset-notes,
    .asset-form button,
    .asset-form .form-error {
        grid-column: auto;
    }
}

body.assets-view {
    --bg-color: #08111a;
    --nav-bg: #08111a;
    --text-color: #f3f6fb;
    --text-muted: #a9b8ca;
    --primary-color: #2f81f7;
    --header-height: calc(76px + env(safe-area-inset-top, 0px));
    --footer-height: 0px;
    background: var(--bg-color);
    color: var(--text-color);
}

body.assets-view .app-header {
    justify-content: space-between;
    padding: env(safe-area-inset-top, 0px) clamp(20px, 4vw, 48px) 0;
    background: #08111a;
    border-color: #263443;
}

body.assets-view .brand-lockup {
    color: #f3f6fb;
}

body.assets-view .app-content {
    margin-bottom: var(--footer-height);
    padding: 0;
    background: #08111a;
    flex: 0 0 auto;
    min-height: 0;
    height: calc(100vh - var(--header-height) - var(--footer-height) - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - var(--header-height) - var(--footer-height) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
}

body.assets-view .app-nav {
    display: flex;
    background: #08111a;
    border-color: #263443;
}

body.assets-view .assets-page {
    max-width: none;
    margin: 0;
    padding-bottom: 40px;
    background: #08111a;
    color: #f3f6fb;
}

body.assets-view .assets-hero {
    min-height: 250px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 24px clamp(24px, 5vw, 64px) 32px;
    background-image:
        linear-gradient(90deg, rgba(8, 17, 26, 0.97) 0%, rgba(8, 17, 26, 0.82) 43%, rgba(8, 17, 26, 0.08) 100%),
        url('/static/images/assets-hero.jpg');
    background-size: 100% 100%, cover;
    background-position: center, center 55%;
    background-repeat: no-repeat;
}

body.assets-view .assets-hero h1 {
    font-size: 38px;
    line-height: 1.12;
}

body.assets-view .assets-hero-copy p {
    max-width: 520px;
    margin-top: 10px;
    color: #d3deec;
    font-size: 17px;
    line-height: 1.45;
}

body.assets-view .assets-add-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 0 0 auto;
    min-height: 50px;
    padding: 0 20px;
    border: 0;
    border-radius: 8px;
    background: #287bf0;
    color: #ffffff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

body.assets-view .assets-add-button:hover,
body.assets-view .asset-submit:hover {
    background: #1768d7;
}

body.assets-view .asset-form-card {
    display: block;
    width: min(1120px, calc(100% - 64px));
    margin: 18px auto 28px;
    padding: 20px 28px 24px;
    border: 1px solid #263443;
    border-radius: 16px;
    background: linear-gradient(145deg, #111d29, #101a24);
}

body.assets-view .asset-form-card[hidden] {
    display: none;
}

body.assets-view .asset-form-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

body.assets-view .asset-form-card-heading h2 {
    font-size: 22px;
}

body.assets-view .asset-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #dce7f4;
    font-size: 26px;
    cursor: pointer;
}

body.assets-view .asset-form {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

body.assets-view .form-section {
    padding: 20px 0 22px;
    border-bottom: 1px solid #263443;
}

body.assets-view .section-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
}

body.assets-view .section-number {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    border: 1px solid #41556a;
    border-radius: 8px;
    color: #a9c9f8;
    font-size: 12px;
    font-weight: 700;
}

body.assets-view .section-heading h2 {
    font-size: 20px;
}

body.assets-view .section-heading p {
    margin-top: 5px;
    color: #a9b8ca;
    font-size: 14px;
}

body.assets-view .field-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px 20px;
}

body.assets-view .asset-form .field-grid label,
body.assets-view .asset-form .field-notes {
    display: grid;
    align-content: start;
    gap: 8px;
    color: #edf2f8;
    font-size: 14px;
    font-weight: 600;
}

body.assets-view .asset-form input,
body.assets-view .asset-form select,
body.assets-view .asset-form textarea {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid #465669;
    border-radius: 7px;
    outline: none;
    background: rgba(10, 18, 27, 0.32);
    color: #f3f6fb;
    font: inherit;
}

body.assets-view .asset-form input::placeholder,
body.assets-view .asset-form textarea::placeholder {
    color: #93a4b9;
    opacity: 1;
}

body.assets-view .asset-form select {
    color-scheme: dark;
}

body.assets-view .asset-form input:focus,
body.assets-view .asset-form select:focus,
body.assets-view .asset-form textarea:focus {
    border-color: #3b91ff;
    box-shadow: 0 0 0 2px rgba(59, 145, 255, 0.2);
}

body.assets-view .field-name { grid-column: span 7; }
body.assets-view .field-category { grid-column: span 5; }
body.assets-view .field-photo { grid-column: 1 / -1; }
body.assets-view .field-make,
body.assets-view .field-model,
body.assets-view .field-year { grid-column: span 4; }
body.assets-view .field-nickname,
body.assets-view .field-color,
body.assets-view .field-serial,
body.assets-view .field-plate { grid-column: span 6; }
body.assets-view .field-address { grid-column: span 7; }
body.assets-view .field-city { grid-column: span 5; }
body.assets-view .field-state,
body.assets-view .field-postal { grid-column: span 6; }

body.assets-view .required-mark {
    color: #ff9d88;
}

body.assets-view .optional-mark {
    color: #a9b8ca;
    font-weight: 400;
}

body.assets-view .photo-label {
    display: block;
    margin-bottom: 9px;
    color: #edf2f8;
    font-size: 14px;
    font-weight: 600;
}

body.assets-view .photo-picker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

body.assets-view .photo-picker-button {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #465669;
    border-radius: 6px;
    background: #1b2a39;
    color: #e5edf7;
    font: inherit;
    cursor: pointer;
}

body.assets-view .photo-file-name {
    display: block;
    margin-top: 8px;
    color: #a9b8ca;
    font-size: 12px;
    overflow-wrap: anywhere;
}

body.assets-view .notes-section {
    border-bottom: 0;
}

body.assets-view .asset-form .field-notes textarea {
    resize: vertical;
}

body.assets-view .notes-limit {
    justify-self: end;
    color: #a9b8ca;
    font-size: 12px;
    font-weight: 400;
}

body.assets-view .form-error {
    padding: 12px 0;
    color: #ff9d88;
}

body.assets-view .asset-actions {
    display: grid;
    grid-template-columns: minmax(120px, 0.7fr) minmax(220px, 1.3fr);
    gap: 12px;
    padding-top: 20px;
}

body.assets-view .asset-actions button {
    min-height: 54px;
    border: 0;
    border-radius: 8px;
    color: #f6f9fd;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

body.assets-view .asset-cancel {
    background: #2a3746;
}

body.assets-view .asset-submit {
    background: #287bf0;
}

body.assets-view .asset-list-section {
    width: min(1120px, calc(100% - 64px));
    margin: 0 auto;
    color: #f3f6fb;
}

body.assets-view .asset-list-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 1px solid #263443;
}

body.assets-view .asset-list-heading span,
body.assets-view .asset-category,
body.assets-view .asset-row p,
body.assets-view .asset-empty {
    color: #a9b8ca;
}

body.assets-view .asset-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 16px;
    border-color: #263443;
    color: inherit;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

body.assets-view .asset-row:hover,
body.assets-view .asset-row:focus-visible {
    border-color: #3b91ff;
    background: rgba(59, 145, 255, 0.08);
    outline: none;
}

body.assets-view .asset-row h3 {
    font-size: 17px;
}

body.assets-view .asset-row-content {
    min-width: 0;
    flex: 1;
}

body.assets-view .asset-thumbnail {
    width: 92px;
    height: 72px;
    flex: 0 0 auto;
    border-radius: 7px;
    object-fit: cover;
}

body.assets-view .asset-open {
    display: inline-flex;
    gap: 6px;
    margin-top: 10px;
    color: #8abaff;
    font-size: 13px;
    font-weight: 700;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.assets-view .asset-details {
    color: #c7d2df !important;
}

.asset-detail-page {
    width: min(960px, calc(100% - 48px));
    margin: 30px auto 48px;
    color: #f3f6fb;
}

.asset-detail-back {
    display: inline-block;
    margin-bottom: 22px;
    color: #a9c9f8;
    font-size: 14px;
    text-decoration: none;
}

.asset-detail-back:hover {
    color: #ffffff;
}

.asset-detail-heading {
    padding-bottom: 22px;
    border-bottom: 1px solid #263443;
}

.asset-detail-photo {
    display: block;
    width: 100%;
    max-height: 420px;
    margin: 22px 0;
    border: 1px solid #263443;
    border-radius: 10px;
    background: #111d29;
    object-fit: contain;
}

.asset-photo-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 0;
    border-bottom: 1px solid #263443;
}

.asset-photo-section h2 {
    font-size: 16px;
}

.asset-photo-section p {
    margin-top: 5px;
    color: #a9b8ca;
    font-size: 13px;
}

.asset-photo-form {
    flex: 0 0 auto;
}

.asset-photo-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.asset-photo-controls .photo-file-name {
    max-width: 180px;
    margin: 0 4px;
}

.asset-photo-controls .asset-submit {
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: #287bf0;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.asset-photo-controls .asset-submit:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.asset-gallery-section {
    padding: 20px 0;
    border-bottom: 1px solid #263443;
}

.asset-gallery-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}

.asset-gallery-heading h2 {
    font-size: 18px;
}

.asset-gallery-heading span,
.asset-gallery-empty {
    color: #a9b8ca;
    font-size: 13px;
}

.asset-carousel {
    position: relative;
}

.asset-carousel-track {
    display: flex;
    min-width: 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    border: 1px solid #263443;
    border-radius: 8px;
    background: #0b1520;
}

.asset-carousel-track::-webkit-scrollbar {
    display: none;
}

.asset-carousel-slide {
    position: relative;
    flex: 0 0 100%;
    min-width: 0;
    margin: 0;
    scroll-snap-align: start;
}

.asset-carousel-slide img {
    display: block;
    width: 100%;
    height: clamp(240px, 56vw, 480px);
    object-fit: cover;
}

.asset-carousel-slide .profile-photo-badge {
    position: absolute;
    right: 10px;
    top: 10px;
    padding: 6px 9px;
    border-radius: 5px;
    background: rgb(8 17 26 / 85%);
}

.asset-carousel-arrow,
.asset-gallery-close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid #465669;
    border-radius: 50%;
    background: #111d29;
    color: #dce7f4;
    font: inherit;
    font-size: 24px;
    cursor: pointer;
}

.asset-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgb(8 17 26 / 70%);
    border-color: rgb(255 255 255 / 25%);
    color: #ffffff;
}

.asset-carousel-arrow.is-prev { left: 10px; }
.asset-carousel-arrow.is-next { right: 10px; }

.asset-carousel-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10px;
    display: flex;
    justify-content: center;
    gap: 6px;
    pointer-events: none;
}

.asset-carousel-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / 50%);
    box-shadow: 0 0 0 1px rgb(0 0 0 / 35%);
    cursor: pointer;
    pointer-events: auto;
}

.asset-carousel-dot.active {
    background: #ffffff;
    transform: scale(1.25);
}

.asset-carousel-arrow:hover,
.asset-gallery-close:hover {
    border-color: #3b91ff;
    color: #ffffff;
}

.asset-carousel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 0;
}

.asset-carousel-count {
    color: #a9b8ca;
    font-size: 13px;
}

.asset-gallery-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid #3b91ff;
    border-radius: 8px;
    background: transparent;
    color: #8abaff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.asset-gallery-link:hover {
    background: #172b40;
}

body.assets-view:not(.dark-mode) .asset-gallery-link {
    border-color: #2563eb;
    color: #2563eb;
}

body.assets-view:not(.dark-mode) .asset-gallery-link:hover {
    background: #eff6ff;
}

.asset-gallery-open {
    padding: 8px 12px;
    border: 1px solid #3b91ff;
    border-radius: 6px;
    background: transparent;
    color: #8abaff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.asset-gallery-open:hover {
    background: #172b40;
}

.asset-gallery-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    width: min(900px, calc(100% - 28px));
    max-width: none;
    max-height: min(90vh, 900px);
    overflow-y: auto;
    padding: 22px;
    border: 1px solid #465669;
    border-radius: 12px;
    background: #111d29;
    color: #dce7f4;
}

.asset-gallery-dialog::backdrop {
    background: rgb(0 0 0 / 70%);
}

.asset-gallery-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.asset-gallery-dialog-header h2 {
    margin-bottom: 4px;
}

.asset-gallery-dialog-header p {
    color: #a9b8ca;
    font-size: 13px;
}

.asset-gallery-dialog .asset-gallery-grid {
    margin-bottom: 22px;
}

.asset-gallery-dialog .asset-photo-section {
    display: block;
    margin: 0 0 22px;
    padding: 0 0 18px;
    border-top: 0;
    border-bottom: 1px solid #263443;
}

.asset-gallery-dialog .asset-photo-section h3 {
    margin-bottom: 5px;
}

.asset-gallery-dialog .asset-photo-section p {
    color: #a9b8ca;
    font-size: 13px;
}

.asset-photo-success {
    margin-bottom: 12px;
    color: #8abaff;
    font-size: 14px;
    font-weight: 700;
}

.asset-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.asset-gallery-item {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #263443;
    border-radius: 8px;
    background: #111d29;
}

.asset-gallery-item.is-profile-photo {
    border-color: #3b91ff;
}

.asset-gallery-item > img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #0b1520;
    object-fit: cover;
}

.asset-gallery-caption {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
}

.profile-photo-badge {
    color: #8abaff;
    font-size: 12px;
    font-weight: 700;
}

.asset-profile-select {
    padding: 6px 8px;
    border: 1px solid #465669;
    border-radius: 5px;
    background: transparent;
    color: #dce7f4;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.asset-profile-select:hover {
    border-color: #3b91ff;
    color: #ffffff;
}

.asset-photo-delete {
    padding: 6px 8px;
    border: 1px solid #8b4141;
    border-radius: 5px;
    background: transparent;
    color: #ffaaaa;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.asset-photo-delete:hover {
    border-color: #ef4444;
    color: #fecaca;
}

.asset-detail-category {
    color: #8abaff;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.asset-detail-heading h1 {
    margin-top: 6px;
    font-size: 32px;
}

.asset-detail-subtitle {
    margin-top: 6px;
    color: #c7d2df;
    font-size: 16px;
}

.asset-detail-section {
    padding: 22px 0;
    border-bottom: 1px solid #263443;
}

.asset-detail-section h2 {
    margin-bottom: 16px;
    font-size: 19px;
}

.asset-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px 24px;
}

.asset-detail-grid > div {
    min-width: 0;
}

.asset-detail-grid dt {
    color: #a9b8ca;
    font-size: 12px;
}

.asset-detail-grid dd {
    margin-top: 5px;
    color: #f3f6fb;
    overflow-wrap: anywhere;
}

.asset-detail-notes {
    color: #d3deec;
    line-height: 1.55;
    white-space: pre-wrap;
}

.asset-documents-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.asset-documents-heading h2 {
    margin-bottom: 5px;
}

.asset-documents-heading p,
.asset-documents-heading > span {
    color: #a9b8ca;
    font-size: 13px;
}

.asset-document-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.7fr);
    gap: 14px;
    margin: 18px 0 22px;
    padding: 16px;
    border: 1px solid #263443;
    border-radius: 8px;
    background: #111d29;
}

.asset-document-form label {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.asset-document-form label > span {
    color: #a9b8ca;
    font-size: 12px;
    font-weight: 700;
}

.asset-document-form input,
.asset-document-form select,
.asset-document-form textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #465669;
    border-radius: 6px;
    background: #0b1520;
    color: #dce7f4;
    font: inherit;
}

.asset-document-form input[type="file"] {
    padding: 8px;
}

.asset-document-file,
.asset-document-notes-field {
    grid-column: 1 / -1;
}

.asset-document-form textarea {
    resize: vertical;
}

.asset-document-submit,
.asset-document-download {
    justify-self: start;
    padding: 9px 13px;
    border: 1px solid #3b91ff;
    border-radius: 6px;
    background: #287bf0;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.asset-document-list {
    display: grid;
    gap: 10px;
}

.asset-document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border: 1px solid #263443;
    border-radius: 8px;
    background: #111d29;
}

.asset-document-info {
    min-width: 0;
}

.asset-document-type {
    color: #8abaff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.asset-document-info h3 {
    margin: 4px 0;
    overflow-wrap: anywhere;
    font-size: 15px;
}

.asset-document-filename,
.asset-document-info time {
    color: #a9b8ca;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.asset-document-info time {
    display: block;
    margin-top: 6px;
}

.asset-document-note {
    margin-top: 7px;
    color: #d3deec;
    font-size: 13px;
    white-space: pre-wrap;
}

.asset-document-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.asset-document-actions .asset-photo-delete {
    color: #ffaaaa;
}

@media (max-width: 600px) {
    .asset-detail-page {
        width: calc(100% - 32px);
        margin-top: 22px;
    }

    .asset-detail-heading h1 {
        font-size: 27px;
    }

    body.assets-view .asset-thumbnail {
        width: 68px;
        height: 64px;
    }

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

    .asset-photo-section {
        align-items: flex-start;
        flex-direction: column;
    }

    .asset-photo-form,
    .asset-photo-controls {
        width: 100%;
    }

    .asset-photo-controls {
        justify-content: flex-start;
    }

    .asset-document-form {
        grid-template-columns: 1fr;
    }

    .asset-document-file,
    .asset-document-notes-field {
        grid-column: auto;
    }

    .asset-document-item {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 700px) {
    body.assets-view {
        --header-height: calc(68px + env(safe-area-inset-top, 0px));
    }

    body.assets-view .app-header {
        padding: env(safe-area-inset-top, 0px) 12px 0;
        gap: 10px;
    }

    body.assets-view .brand-lockup {
        gap: 2px;
        font-size: 15px;
    }

    body.assets-view .logo-container {
        width: 42px;
        height: 34px;
    }

    body.assets-view .logo-container img {
        width: 42px;
        height: 34px;
    }

    body.assets-view .logo-container img {
        filter: none;
        mix-blend-mode: normal;
    }

    body.assets-view .assets-hero {
        min-height: 200px;
        padding: 20px 22px 24px;
        background-position: center, 62% center;
    }

    body.assets-view .assets-hero h1 {
        font-size: 30px;
    }

    body.assets-view .assets-hero-copy p {
        max-width: 420px;
        font-size: 15px;
    }

    body.assets-view .assets-add-button {
        min-height: 44px;
        padding: 0 12px;
        font-size: 13px;
    }

    body.assets-view .wide-break {
        display: none;
    }

    body.assets-view .asset-form-card,
    body.assets-view .asset-list-section {
        width: calc(100% - 24px);
    }

    body.assets-view .asset-form-card {
        padding: 6px 16px 18px;
        border-radius: 12px;
    }

    body.assets-view .field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 12px;
    }

    body.assets-view .field-name,
    body.assets-view .field-category,
    body.assets-view .field-address,
    body.assets-view .field-photo {
        grid-column: 1 / -1;
    }

    body.assets-view .field-make,
    body.assets-view .field-model,
    body.assets-view .field-year,
    body.assets-view .field-nickname,
    body.assets-view .field-color,
    body.assets-view .field-serial,
    body.assets-view .field-plate,
    body.assets-view .field-city,
    body.assets-view .field-state,
    body.assets-view .field-postal {
        grid-column: span 1;
    }

    body.assets-view .field-photo {
        grid-column: 1 / -1;
    }
}

@media (max-width: 380px) {
    body.assets-view .brand-lockup {
        font-size: 13px;
    }

    body.assets-view .logo-container {
        width: 36px;
    }

    body.assets-view .logo-container img {
        width: 36px;
        height: 34px;
    }
}

body.assets-view:not(.dark-mode) {
    --bg-color: #f8fafc;
    --nav-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --primary-color: #2563eb;
    background: var(--bg-color);
    color: var(--text-color);
}

body.assets-view:not(.dark-mode) .app-header,
body.assets-view:not(.dark-mode) .app-nav {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.assets-view:not(.dark-mode) .brand-lockup {
    color: #111111;
}

body.assets-view:not(.dark-mode) .app-content,
body.assets-view:not(.dark-mode) .assets-page {
    background: #f8fafc;
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .assets-hero {
    background-image:
        linear-gradient(90deg, rgba(248, 250, 252, 0.97) 0%, rgba(248, 250, 252, 0.82) 43%, rgba(248, 250, 252, 0.12) 100%),
        url('/static/images/assets-hero.jpg');
}

body.assets-view:not(.dark-mode) .assets-hero-copy p {
    color: #334155;
}

body.assets-view:not(.dark-mode) .asset-form-card {
    border-color: #dbe4ee;
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

body.assets-view:not(.dark-mode) .form-section,
body.assets-view:not(.dark-mode) .asset-list-heading,
body.assets-view:not(.dark-mode) .asset-row,
body.assets-view:not(.dark-mode) .asset-detail-heading,
body.assets-view:not(.dark-mode) .asset-detail-section {
    border-color: #dbe4ee;
}

body.assets-view:not(.dark-mode) .section-heading p,
body.assets-view:not(.dark-mode) .optional-mark,
body.assets-view:not(.dark-mode) .photo-file-name,
body.assets-view:not(.dark-mode) .notes-limit,
body.assets-view:not(.dark-mode) .asset-list-heading span,
body.assets-view:not(.dark-mode) .asset-category,
body.assets-view:not(.dark-mode) .asset-row p,
body.assets-view:not(.dark-mode) .asset-empty {
    color: #64748b;
}

body.assets-view:not(.dark-mode) .section-number {
    border-color: #cbd5e1;
    color: #2563eb;
}

body.assets-view:not(.dark-mode) .asset-form .field-grid label,
body.assets-view:not(.dark-mode) .asset-form .field-notes,
body.assets-view:not(.dark-mode) .photo-label {
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-form input,
body.assets-view:not(.dark-mode) .asset-form select,
body.assets-view:not(.dark-mode) .asset-form textarea {
    border-color: #cbd5e1;
    background: #ffffff;
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-form input::placeholder,
body.assets-view:not(.dark-mode) .asset-form textarea::placeholder {
    color: #64748b;
}

body.assets-view:not(.dark-mode) .asset-form select {
    color-scheme: light;
}

body.assets-view:not(.dark-mode) .required-mark,
body.assets-view:not(.dark-mode) .form-error {
    color: #b91c1c;
}

body.assets-view:not(.dark-mode) .photo-picker-button {
    border-color: #cbd5e1;
    background: #f1f5f9;
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-actions button {
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-cancel {
    background: #e2e8f0;
}

body.assets-view:not(.dark-mode) .asset-submit {
    color: #ffffff;
}

body.assets-view:not(.dark-mode) .asset-open {
    color: #2563eb;
}

body.assets-view:not(.dark-mode) .asset-detail-page {
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-detail-back {
    color: #2563eb;
}

body.assets-view:not(.dark-mode) .asset-detail-back:hover {
    color: #1d4ed8;
}

body.assets-view:not(.dark-mode) .asset-detail-category {
    color: #2563eb;
}

body.assets-view:not(.dark-mode) .asset-detail-subtitle,
body.assets-view:not(.dark-mode) .asset-detail-notes {
    color: #334155;
}

body.assets-view:not(.dark-mode) .asset-detail-grid dt {
    color: #64748b;
}

body.assets-view:not(.dark-mode) .asset-detail-grid dd {
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-detail-photo {
    border-color: #dbe4ee;
    background: #ffffff;
}

body.assets-view:not(.dark-mode) .asset-photo-section {
    border-color: #dbe4ee;
}

body.assets-view:not(.dark-mode) .asset-photo-section p,
body.assets-view:not(.dark-mode) .asset-photo-controls .photo-file-name,
body.assets-view:not(.dark-mode) .asset-gallery-heading span,
body.assets-view:not(.dark-mode) .asset-gallery-empty {
    color: #64748b;
}

body.assets-view:not(.dark-mode) .asset-photo-success {
    color: #1d4ed8;
}

body.assets-view:not(.dark-mode) .asset-gallery-section,
body.assets-view:not(.dark-mode) .asset-gallery-item,
body.assets-view:not(.dark-mode) .asset-carousel-track {
    border-color: #dbe4ee;
}

body.assets-view:not(.dark-mode) .asset-gallery-item {
    background: #ffffff;
}

body.assets-view:not(.dark-mode) .asset-carousel-track {
    background: #f1f5f9;
}

body.assets-view:not(.dark-mode) .asset-carousel-arrow,
body.assets-view:not(.dark-mode) .asset-gallery-close {
    border-color: #cbd5e1;
    background: #ffffff;
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-carousel-count {
    color: #64748b;
}

body.assets-view:not(.dark-mode) .asset-gallery-open {
    border-color: #2563eb;
    color: #1d4ed8;
}

body.assets-view:not(.dark-mode) .asset-gallery-open:hover {
    background: #eff6ff;
}

body.assets-view:not(.dark-mode) .asset-gallery-dialog {
    border-color: #dbe4ee;
    background: #ffffff;
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-gallery-dialog-header p,
body.assets-view:not(.dark-mode) .asset-gallery-dialog .asset-photo-section p {
    color: #64748b;
}

body.assets-view:not(.dark-mode) .asset-gallery-dialog .asset-photo-section {
    border-color: #dbe4ee;
}

body.assets-view:not(.dark-mode) .asset-gallery-item.is-profile-photo {
    border-color: #2563eb;
}

body.assets-view:not(.dark-mode) .profile-photo-badge {
    color: #1d4ed8;
}

body.assets-view:not(.dark-mode) .asset-profile-select {
    border-color: #cbd5e1;
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-profile-select:hover {
    border-color: #2563eb;
    color: #1d4ed8;
}

body.assets-view:not(.dark-mode) .asset-photo-delete {
    border-color: #fecaca;
    color: #b91c1c;
}

body.assets-view:not(.dark-mode) .asset-photo-delete:hover {
    border-color: #ef4444;
    color: #991b1b;
}

body.assets-view:not(.dark-mode) .asset-documents-heading p,
body.assets-view:not(.dark-mode) .asset-documents-heading > span,
body.assets-view:not(.dark-mode) .asset-document-form label > span,
body.assets-view:not(.dark-mode) .asset-document-filename,
body.assets-view:not(.dark-mode) .asset-document-info time {
    color: #64748b;
}

body.assets-view:not(.dark-mode) .asset-document-form,
body.assets-view:not(.dark-mode) .asset-document-item {
    border-color: #dbe4ee;
    background: #ffffff;
}

body.assets-view:not(.dark-mode) .asset-document-form input,
body.assets-view:not(.dark-mode) .asset-document-form select,
body.assets-view:not(.dark-mode) .asset-document-form textarea {
    border-color: #cbd5e1;
    background: #ffffff;
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-document-form select {
    color-scheme: light;
}

body.assets-view:not(.dark-mode) .asset-document-type {
    color: #2563eb;
}

body.assets-view:not(.dark-mode) .asset-document-note {
    color: #334155;
}

.asset-detail-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.asset-detail-section-head h2 {
    margin: 0;
}

.asset-edit-dialog .field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.asset-edit-dialog .field-name,
.asset-edit-dialog .field-address {
    grid-column: 1 / -1;
}

.asset-edit-dialog .asset-edit-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.asset-edit-dialog .asset-edit-form button[type="submit"] {
    align-self: stretch;
}

@media (max-width: 480px) {
    .asset-edit-dialog .field-grid {
        grid-template-columns: 1fr;
    }
}

.asset-documents-dropdown > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border: 1px solid #3b91ff;
    border-radius: 8px;
    color: #8abaff;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.asset-documents-dropdown > summary::-webkit-details-marker {
    display: none;
}

.asset-documents-dropdown > summary::after {
    content: "▾";
    transition: transform 0.2s ease;
}

.asset-documents-dropdown[open] > summary::after {
    transform: rotate(180deg);
}

.asset-documents-dropdown .asset-document-list,
.asset-documents-dropdown .asset-gallery-empty {
    margin-top: 12px;
}

body.assets-view:not(.dark-mode) .asset-documents-dropdown > summary {
    border-color: #2563eb;
    color: #2563eb;
}

.asset-document-dialog .asset-document-file > span:first-child {
    display: block;
    margin-bottom: 8px;
}

.asset-document-buttons {
    display: flex;
    gap: 10px;
}

.asset-document-buttons button {
    flex: 1;
}

.asset-document-cancel {
    padding: 10px 14px;
    border: 1px solid #465669;
    border-radius: 6px;
    background: transparent;
    color: #dce7f4;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

body.assets-view:not(.dark-mode) .asset-document-cancel {
    border-color: #cbd5e1;
    color: #1e293b;
}

.asset-document-form input.visually-hidden {
    width: 1px;
    padding: 0;
    border: 0;
}

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

.maintenance-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title arrow" "meta arrow";
    align-items: center;
    gap: 2px 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #263443;
    border-radius: 8px;
    background: #0b1520;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.maintenance-row:hover {
    border-color: #3b91ff;
}

.maintenance-row-title {
    grid-area: title;
    font-weight: 700;
}

.maintenance-row-meta {
    grid-area: meta;
    color: #a9b8ca;
    font-size: 13px;
}

.maintenance-row-arrow {
    grid-area: arrow;
    color: #8abaff;
    font-size: 22px;
}

.maintenance-dialog {
    width: min(560px, calc(100% - 28px));
}

.maintenance-dialog > * + * {
    margin-top: 14px;
}

.maintenance-attachment {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    margin-inline: auto;
    border-radius: 8px;
}

body.assets-view:not(.dark-mode) .maintenance-row {
    border-color: #dbe4ee;
    background: #ffffff;
}

body.assets-view:not(.dark-mode) .maintenance-row-meta {
    color: #64748b;
}

body.assets-view:not(.dark-mode) .maintenance-row-arrow {
    color: #2563eb;
}

.asset-document-form .asset-photo-controls {
    justify-content: flex-start;
}

.document-pending-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 0;
    list-style: none;
}

.document-pending-list:empty {
    display: none;
}

.document-pending-list li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 6px 6px 12px;
    border: 1px solid #465669;
    border-radius: 999px;
    background: #1b2a39;
    color: #e5edf7;
    font-size: 14px;
}

.document-pending-list button {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

body.assets-view:not(.dark-mode) .document-pending-list li {
    border-color: #cbd5e1;
    background: #f1f5f9;
    color: #1e293b;
}

.odometer-reader {
    grid-column: 1 / -1;
    margin-top: -4px;
}

.odometer-status {
    margin-top: 8px;
    color: #a9b8ca;
    font-size: 13px;
}

body.assets-view:not(.dark-mode) .odometer-status {
    color: #64748b;
}

/* Keep the heading link and the Add/Edit buttons the same size */
.asset-gallery-link,
.asset-gallery-open {
    padding: 10px 16px;
    font-size: 16px;
    line-height: 1.2;
}

.odometer-label {
    display: block;
    margin-bottom: 8px;
}

.maintenance-attachment-label {
    color: #a9b8ca;
    font-size: 13px;
}

body.assets-view:not(.dark-mode) .maintenance-attachment-label {
    color: #64748b;
}

.asset-detail-heading .asset-detail-section-head {
    margin: 6px 0;
}

.asset-detail-heading h1 {
    font-size: inherit;
    min-width: 0;
}

.asset-info-dialog .asset-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.asset-info-notes-heading {
    margin: 20px 0 6px;
    font-size: 16px;
}

@media (max-width: 480px) {
    .asset-info-dialog .asset-detail-grid {
        grid-template-columns: 1fr;
    }
}

.wishlist-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wishlist-done > summary {
    padding: 10px 14px;
    border: 1px solid #3b91ff;
    border-radius: 8px;
    color: #8abaff;
    font-weight: 700;
    cursor: pointer;
}

.wishlist-done[open] > summary {
    margin-bottom: 12px;
}

body.assets-view:not(.dark-mode) .wishlist-done > summary {
    border-color: #2563eb;
    color: #2563eb;
}

.wishlist-miles-note {
    color: #a9b8ca;
    font-size: 12px;
    font-weight: 400;
}

/* Maintenance / Modifications / Wish List rows: only a button row, so keep them tight */
.asset-documents-section {
    padding: 10px 0;
}

.asset-documents-section .asset-detail-section-head {
    margin-bottom: 0;
}

.asset-documents-section .asset-photo-success {
    margin-top: 10px;
}

/* Make the hidden attribute win over component display rules (grid/flex labels, buttons, etc.) */
[hidden] {
    display: none !important;
}

.record-update-form input[type="file"] {
    width: 100%;
}

.vin-scan {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.vin-scan .asset-photo-controls {
    justify-content: flex-start;
}

.vin-block {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

body.assets-view .field-category-full { grid-column: 1 / -1; }

/* Add asset: one screen at a time. */
.wizard-progress {
    margin-bottom: 16px;
    font-weight: 700;
}

.wizard-bar {
    height: 6px;
    margin-top: 8px;
    border-radius: 999px;
    background: rgba(127, 127, 127, 0.25);
    overflow: hidden;
}

.wizard-bar > span {
    display: block;
    height: 100%;
    background: #3b91ff;
    transition: width 0.2s ease;
}

.wizard-step h3 {
    margin: 0 0 6px;
    font-size: 1.25rem;
}

.wizard-hint {
    margin: 0 0 14px;
    opacity: 0.8;
}

.wizard-step .vin-scan {
    margin-bottom: 12px;
}

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

body.assets-view .asset-form button.type-choice {
    width: 100%;
    min-height: 0;
    padding: 22px 12px;
    border: 1px solid #3b91ff;
    border-radius: 12px;
    background: transparent;
    color: #2563eb;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
}

body.assets-view .asset-form button.type-choice:hover,
body.assets-view .asset-form button.type-choice:focus-visible {
    background: rgba(59, 145, 255, 0.15);
}
.wizard-nav {
    margin-top: 20px;
}

body.assets-view .asset-form .wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

body.assets-view .asset-form .wizard-nav .asset-submit {
    margin-left: auto;
}

/* Wish list project parts */
.wishlist-parts {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}

.wishlist-parts h3 {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    font-size: 1.05rem;
}

.wishlist-parts-total {
    font-weight: 700;
    color: #2563eb;
}

.wishlist-part {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(127, 127, 127, 0.25);
}

.wishlist-part-text {
    display: grid;
    min-width: 0;
}

.wishlist-part-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.wishlist-part-cost {
    opacity: 0.8;
}

.wishlist-part form {
    margin: 0;
}

.wishlist-part-remove {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #b91c1c;
    border-radius: 8px;
    background: transparent;
    color: #b91c1c;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Wish list add form: several parts with a running total */
.wishlist-parts-editor {
    display: grid;
    gap: 10px;
}

.wishlist-parts-editor h3 {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin: 0;
    font-size: 1.05rem;
}

.wishlist-part-row {
    display: grid;
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid rgba(127, 127, 127, 0.25);
}

.wishlist-part-row .price-lookup {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.asset-document-form .wishlist-part-row button.wishlist-part-remove {
    background: transparent;
    color: #b91c1c;
}

/* Wish list details: one line per item, prices on the right, total at the bottom */
.wishlist-part-price {
    margin-left: auto;
    font-weight: 700;
    white-space: nowrap;
}

.wishlist-part-link {
    font-size: 0.9rem;
}

.wishlist-part-total-line {
    border-top: 2px solid rgba(127, 127, 127, 0.5);
    border-bottom: 0;
    font-size: 1.05rem;
}

.wishlist-part-total-line .wishlist-part-name {
    flex: 1;
}

/* Wish list details: project header, then a list of expandable parts */
.wishlist-project {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.wishlist-project .asset-document-note {
    margin: 0;
}

.wishlist-part-item {
    border-bottom: 1px solid rgba(127, 127, 127, 0.25);
}

.wishlist-part-item > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    cursor: pointer;
}

.wishlist-part-item > summary::marker {
    color: #3b91ff;
}

.wishlist-part-body {
    display: grid;
    gap: 12px;
    padding: 4px 0 14px;
}

.wishlist-part-body form {
    margin: 0;
}

/* Wish list project: pencil button beside the close button */
.asset-gallery-dialog-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.record-edit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #3b91ff;
    border-radius: 8px;
    background: transparent;
    color: #2563eb;
    cursor: pointer;
}

.wishlist-edit-panel {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(127, 127, 127, 0.25);
}

.wishlist-estimate {
    font-size: 1.05rem;
}

.wishlist-part-item > summary .record-edit-button {
    flex-shrink: 0;
}

.wishlist-part-item > summary .wishlist-part-price {
    margin-left: auto;
}

.wishlist-edit-panel form + form {
    margin-top: 12px;
}

.wishlist-part-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    min-width: 0;
}

.wishlist-part-item > summary .wishlist-part-link {
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}

.wishlist-edit-panel > details,
.wishlist-edit-panel > form + form {
    margin-top: 12px;
}

/* Dark mode: dark scrollbars (the slider on the right and inside pop ups) */
body.dark-mode,
body.dark-mode .app-content,
body.dark-mode dialog,
body.dark-mode textarea {
    scrollbar-color: #3b4a5e #08111a;
}

@supports not (scrollbar-color: auto) {
    body.dark-mode ::-webkit-scrollbar {
        width: 12px;
        height: 12px;
    }

    body.dark-mode ::-webkit-scrollbar-track {
        background: #08111a;
    }

    body.dark-mode ::-webkit-scrollbar-thumb {
        background: #3b4a5e;
        border-radius: 8px;
        border: 2px solid #08111a;
    }
}

/* Add asset screens: each field on its own line, one after the other */
body.assets-view .asset-wizard .field-grid {
    grid-template-columns: 1fr;
}

body.assets-view .asset-wizard .field-grid > * {
    grid-column: 1 / -1;
}

/* Add asset card: a comfortable width on a computer instead of stretching across the page */
@media (min-width: 761px) {
    body.assets-view .asset-form-card {
        width: min(620px, calc(100% - 64px));
        padding: 20px 28px 24px;
    }
}

/* Add asset screens: give the miles / VIN screens room to breathe */
.asset-wizard .new-asset-miles,
.asset-wizard .vin-scan {
    display: grid;
    gap: 18px;
    margin-top: 14px;
}

.asset-wizard .new-asset-miles > label,
.asset-wizard .vin-scan > label {
    display: grid;
    gap: 6px;
}

.asset-wizard .odometer-reader {
    display: grid;
    gap: 10px;
    margin-top: 0;
}

.asset-wizard .odometer-label {
    margin-bottom: 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.asset-wizard .asset-photo-controls {
    justify-content: flex-start;
}

.asset-wizard .odometer-status {
    margin: 0;
}

/* Add asset screens: spacing on the Miscellaneous / Photo screens */
.asset-wizard .wizard-step[data-step="misc"],
.asset-wizard .wizard-step[data-step="photo"] {
    display: grid;
    gap: 18px;
    align-content: start;
}

.asset-wizard .wizard-step[data-step="misc"][hidden],
.asset-wizard .wizard-step[data-step="photo"][hidden] {
    display: none;
}

.asset-wizard .wizard-step[data-step="misc"] .field-grid {
    display: grid;
    gap: 18px;
    margin: 0;
}

.asset-wizard .wizard-step[data-step="misc"] label {
    display: grid;
    gap: 6px;
    margin: 0;
}

.asset-wizard .wizard-step[data-step="misc"] .notes-limit {
    margin-top: 2px;
    font-size: 0.8rem;
    opacity: 0.7;
}

.asset-wizard .field-photo {
    display: grid;
    gap: 10px;
}

.asset-wizard .photo-picker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}

/* Wish list add: two screens (project, then parts) */
.asset-document-form .wishlist-step {
    display: grid;
    gap: 18px;
}

.asset-document-form .wishlist-step[hidden] {
    display: none;
}

.wizard-progress-text {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0.75;
}

.wishlist-step-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    margin-top: 6px;
}

/* Wish list add: one column, every piece full width */
#wishlist-add-dialog .asset-document-form {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

#wishlist-add-dialog .asset-document-form > *,
#wishlist-add-dialog .wishlist-step > * {
    grid-column: 1 / -1;
}

/* Wish list add: each part is its own card inside the form card */
#wishlist-add-dialog .wishlist-part-row {
    gap: 14px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid rgba(127, 127, 127, 0.35);
    border-radius: 10px;
    background: rgba(127, 127, 127, 0.08);
}

#wishlist-add-dialog .wishlist-part-row label {
    display: grid;
    gap: 6px;
}

/* Add button inside the record lists */
.list-dialog-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Newest few records shown under each section heading */
.recent-list {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.recent-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 10px;
    align-items: center;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 8px;
    background: rgba(127, 127, 127, 0.08);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.recent-row-title {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-row-meta {
    grid-column: 1;
    font-size: 0.8rem;
    opacity: 0.75;
}

.recent-row .maintenance-row-arrow {
    grid-column: 2;
    grid-row: 1 / span 2;
}

/* Delete buttons at the bottom of a pop up: set apart from the content above, full width */
dialog > form:has(> .asset-photo-delete) {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(127, 127, 127, 0.3);
}

dialog > form > .asset-photo-delete,
.wishlist-edit-panel form .asset-photo-delete {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-weight: 700;
}

dialog > .asset-gallery-empty {
    margin-top: 22px;
}

.wishlist-edit-panel form:has(> .asset-photo-delete) {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(127, 127, 127, 0.3);
}

.wishlist-delete-form[hidden] {
    display: none;
}

/* Maintenance / Modifications / Wish List etc.: each section is its own card */
.asset-documents-section {
    margin-top: 16px;
    padding: 16px 18px;
    border: 1px solid #263443;
    border-radius: 12px;
    background: #111d29;
}

body.assets-view:not(.dark-mode) .asset-documents-section {
    border-color: #dbe4ee;
    background: #ffffff;
}

.section-count {
    font-weight: 400;
    opacity: 0.75;
}

/* Maintenance: next due */
.next-due-fields {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 14px;
    border: 1px solid rgba(127, 127, 127, 0.35);
    border-radius: 10px;
}

.next-due-fields legend {
    padding: 0 6px;
    font-size: 0.85rem;
    font-weight: 700;
}

.recent-label {
    margin: 12px 0 0;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.7;
}

.recent-label + .recent-list {
    margin-top: 6px;
}

.recent-row.due-overdue {
    border-color: #ef4444;
}

.recent-row.due-overdue .recent-row-meta {
    color: #f87171;
    opacity: 1;
}

.recent-row.due-soon {
    border-color: #f59e0b;
}

.recent-row.due-soon .recent-row-meta {
    color: #fbbf24;
    opacity: 1;
}

body.assets-view:not(.dark-mode) .recent-row.due-overdue .recent-row-meta { color: #b91c1c; }
body.assets-view:not(.dark-mode) .recent-row.due-soon .recent-row-meta { color: #b45309; }

/* Maintenance add: one column, one screen at a time */
#maintenance-asset-document-dialog .asset-document-form {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

#maintenance-asset-document-dialog .asset-document-form > *,
#maintenance-asset-document-dialog .wishlist-step > * {
    grid-column: 1 / -1;
}

#maintenance-asset-document-dialog .odometer-reader {
    display: grid;
    gap: 10px;
}

.interval-note {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.14);
}

.service-schedule {
    margin: 0 0 14px;
    padding: 10px 14px;
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 10px;
}

.service-schedule summary {
    cursor: pointer;
    font-weight: 700;
}

.service-schedule ul {
    display: grid;
    gap: 6px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.service-schedule li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.9rem;
}

.service-schedule li span:last-child {
    opacity: 0.75;
    text-align: right;
}

.due-every-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(110px, 0.6fr);
    gap: 12px;
    align-items: end;
}

.due-every-row label {
    display: grid;
    gap: 6px;
}

.share-gallery {
    display: flex !important;
    align-items: center;
    gap: 10px;
}

.share-gallery input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex: none;
}

.shared-badge {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.record-picture-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.record-picture-edit {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.record-picture-edit .maintenance-attachment {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    max-height: none;
    object-fit: cover;
    margin: 0;
}

.record-picture-actions {
    display: flex;
    gap: 8px;
}

.wishlist-edit-panel .record-picture-actions form,
.wishlist-edit-panel .record-picture-actions form:has(> .asset-photo-delete) {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.wishlist-edit-panel .record-picture-actions form button {
    width: 100%;
    margin: 0;
    padding: 8px 4px;
    font-size: 0.9rem;
    font-weight: 600;
}

.record-picture-actions .is-shared {
    border-color: #3fb950;
    color: #3fb950;
}

.record-picture-heading {
    margin: 16px 0 6px;
    font-size: 0.95rem;
}

.wishlist-edit-panel .record-picture-type {
    margin: 0;
    padding: 0;
    border: 0;
}

.record-picture-type select {
    width: 100%;
}

.record-card {
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid rgba(127, 127, 127, 0.35);
    border-radius: 12px;
    background: rgba(127, 127, 127, 0.08);
}

.record-card-title {
    margin: 0 0 10px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.75;
}

.record-card-main {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 600;
}

.record-card label {
    display: grid;
    gap: 6px;
    min-width: 0;
    margin-top: 12px;
}

.record-card label > span {
    color: #a9b8ca;
    font-size: 12px;
    font-weight: 700;
}

.record-card input,
.record-card select,
.record-card textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #465669;
    border-radius: 6px;
    background: #0b1520;
    color: #dce7f4;
    font: inherit;
}

.record-card input[type="file"] {
    padding: 8px;
}

.record-card textarea {
    resize: vertical;
}

.record-card .asset-document-submit {
    margin-top: 14px;
}

body.assets-view:not(.dark-mode) .record-card label > span {
    color: #64748b;
}

body.assets-view:not(.dark-mode) .record-card input,
body.assets-view:not(.dark-mode) .record-card select,
body.assets-view:not(.dark-mode) .record-card textarea {
    border-color: #cbd5e1;
    background: #ffffff;
    color: #1e293b;
}

.record-card .maintenance-attachment {
    margin-top: 10px;
}

.record-picture-add {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.asset-detail-head-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

a.recent-row {
    text-decoration: none;
}

/* Maintenance icon: the orange of the sun in the logo */
.header-icon.header-icon-maintenance,
.header-icon.header-icon-maintenance.active {
    color: #f58a1f;
}

/* Maintenance page: asset picture on the left of each row */
.recent-row.maintenance-upcoming-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
}

.maintenance-asset-photo {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(127, 127, 127, 0.2);
}

.maintenance-upcoming-row .recent-row-title,
.maintenance-upcoming-row .recent-row-meta {
    grid-column: 2;
}

.maintenance-upcoming-row .maintenance-row-arrow {
    grid-column: 3;
}

/* Keep the maintenance schedule inside the screen on phones */
.asset-detail-section-head {
    flex-wrap: wrap;
}

.asset-detail-section-head h2 {
    flex: 1 1 auto;
    min-width: 0;
}

.asset-detail-section-head h2 button {
    white-space: nowrap;
}

.asset-detail-head-actions {
    flex: none;
    margin-left: auto;
}

.asset-detail-head-actions .asset-gallery-open {
    white-space: nowrap;
}

#maintenance-schedule-dialog,
#maintenance-schedule-dialog .record-card,
#maintenance-schedule-dialog .record-update-form,
#maintenance-schedule-dialog label {
    min-width: 0;
    max-width: 100%;
}

#maintenance-schedule-dialog input,
#maintenance-schedule-dialog select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#maintenance-schedule-dialog .due-every-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.7fr);
}

/* Maintenance schedule: a plain list, each with an Edit button that opens its form */
.schedule-item {
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 10px;
    background: rgba(127, 127, 127, 0.08);
}

.schedule-item > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    list-style: none;
}

.schedule-item > summary::-webkit-details-marker {
    display: none;
}

.schedule-item-text {
    display: grid;
    min-width: 0;
}

.schedule-item-text .recent-row-meta {
    font-size: 0.8rem;
    opacity: 0.75;
}

.schedule-item > .record-update-form {
    padding: 0 12px 12px;
}


/* The schedule's forms look like the other record forms */
.schedule-item label {
    display: grid;
    gap: 6px;
    min-width: 0;
    margin-top: 12px;
}

.schedule-item label > span {
    color: #a9b8ca;
    font-size: 12px;
    font-weight: 700;
}

.schedule-item input,
.schedule-item select {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #465669;
    border-radius: 6px;
    background: #0b1520;
    color: #dce7f4;
    font: inherit;
}

.schedule-item .asset-document-submit {
    margin-top: 14px;
}

.schedule-item > .record-update-form {
    padding-top: 2px;
}

body.assets-view:not(.dark-mode) .schedule-item label > span {
    color: #64748b;
}

body.assets-view:not(.dark-mode) .schedule-item input,
body.assets-view:not(.dark-mode) .schedule-item select {
    border-color: #cbd5e1;
    background: #ffffff;
    color: #1e293b;
}

/* Schedule Save and Remove: same size, Save left and Remove right */
.schedule-item .record-picture-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.schedule-item .record-picture-actions .asset-document-submit,
.schedule-item .record-picture-actions .asset-photo-delete {
    width: 100%;
    margin: 0;
    padding: 12px 14px;
    font-size: 1rem;
    font-weight: 700;
    box-sizing: border-box;
}

.profile-card {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
}

.profile-card h2 {
    margin: 0 0 12px;
    font-size: 17px;
}

.profile-details {
    display: grid;
    gap: 10px;
    margin: 0;
}

.profile-details div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.profile-details dt {
    color: var(--text-muted);
}

.profile-details dd {
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.profile-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.profile-badge.ok { background: #dcfce7; color: #166534; }
.profile-badge.warn { background: #fef3c7; color: #92400e; }

.profile-plan-line { margin: 0 0 4px; font-size: 18px; }
.profile-muted { margin: 4px 0 8px; color: var(--text-muted); font-size: 14px; }
.profile-success { margin: 0 0 10px; color: #15803d; font-weight: 600; }

.save-preferences.secondary {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.profile-password-form {
    display: grid;
    gap: 12px;
}

.profile-password-form label {
    display: grid;
    gap: 4px;
    font-weight: 600;
}

.profile-password-form input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    font: inherit;
}

.plan-note {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.plan-note-full { color: #b45309; font-weight: 600; }

body.dark-mode .profile-card { border-color: #334155; }
body.dark-mode .profile-badge { background: #334155; color: #e2e8f0; }
body.dark-mode .profile-badge.ok { background: #14532d; color: #bbf7d0; }
body.dark-mode .profile-badge.warn { background: #78350f; color: #fde68a; }
body.dark-mode .profile-password-form input { background: #0f172a; color: #e2e8f0; border-color: #475569; }
body.dark-mode .plan-note-full { color: #fbbf24; }

.profile-card .password-meter { margin-top: 4px; }
.profile-card .password-meter-bar { height: 6px; border-radius: 3px; background: rgba(127,127,127,0.25); overflow: hidden; }
.profile-card .password-meter-bar span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.profile-card .password-meter small { display: block; margin-top: 4px; color: var(--text-muted); font-size: 13px; font-weight: 400; }

body.dark-mode .save-preferences.secondary {
    background: transparent;
    color: var(--primary-color);
}

.upgrade-dialog p { margin: 12px 0 16px; }
.upgrade-link { display: inline-block; text-decoration: none; }

/* Heading and its buttons stay on one row */
.asset-documents-section .asset-detail-section-head {
    flex-wrap: nowrap;
}

.asset-documents-section .asset-detail-head-actions {
    flex: 0 0 auto;
}

.asset-documents-section .asset-detail-head-actions .asset-gallery-open {
    white-space: nowrap;
    padding-left: 12px;
    padding-right: 12px;
}

/* Heading and Schedule buttons match: same spacing before the count, count in regular weight */
.asset-gallery-link,
.asset-gallery-open {
    gap: 4px;
}

.asset-gallery-open {
    display: inline-flex;
    align-items: center;
}

.add-maintenance-bar {
    display: flex;
    justify-content: flex-start;
    margin: 0 0 14px;
}

.install-app-button[hidden] {
    display: none;
}

/* Maintenance tab: keep the button, rows and messages off the screen edges, lined up with the heading */
.assets-page > .add-maintenance-bar,
.assets-page > .recent-list,
.assets-page > .asset-gallery-empty {
    margin-left: clamp(24px, 5vw, 64px);
    margin-right: clamp(24px, 5vw, 64px);
}

.assets-page > .add-maintenance-bar {
    margin-top: 16px;
}

/* Mileage timeline and lease */
.mileage-current {
    margin: 12px 0 0;
}

.mileage-current span {
    opacity: 0.75;
    font-size: 0.85rem;
}

.mileage-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.mileage-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 10px;
    align-items: center;
    padding: 9px 12px;
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-radius: 8px;
    background: rgba(127, 127, 127, 0.08);
}

.mileage-row-meta {
    grid-column: 1;
    font-size: 0.8rem;
    opacity: 0.75;
    overflow-wrap: anywhere;
}

.mileage-row form {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
}

.mileage-row .asset-photo-delete {
    width: auto;
    margin: 0;
    padding: 6px 10px;
}

.mileage-delta {
    font-size: 0.8rem;
    font-weight: 400;
    color: #34d399;
}

.lease-card {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid rgba(127, 127, 127, 0.35);
    border-radius: 10px;
    display: grid;
    gap: 10px;
}

.lease-card.lease-watch { border-color: #f59e0b; }
.lease-card.lease-over { border-color: #ef4444; }

.lease-card-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
}

.lease-card-head span {
    opacity: 0.75;
    font-size: 0.85rem;
}

.lease-bar {
    position: relative;
    height: 12px;
    border-radius: 6px;
    background: rgba(127, 127, 127, 0.25);
    overflow: visible;
}

.lease-bar-used {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: #3b91ff;
}

.lease-watch .lease-bar-used { background: #f59e0b; }
.lease-over .lease-bar-used { background: #ef4444; }

/* Where you should be by today if you drive evenly across the lease */
.lease-bar-time {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 2px;
    background: currentColor;
}

.lease-line {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.4;
}

.lease-card .asset-gallery-open {
    justify-self: start;
}

/* The logo mark in the header's top right is the Profile button (Home when signed out) */
.profile-mark {
    flex: 0 0 auto;
    margin-left: 4px;
    border-radius: 10px;
}

.profile-mark {
    -webkit-tap-highlight-color: transparent;
}

.profile-mark:focus:not(:focus-visible) {
    outline: none;
}

/* Two icons on the left plus the full logo on the right must fit a small phone */
.header-nav-left {
    flex: 0 0 auto;
}

.header-nav-right {
    flex: 1 1 auto;
}

/* Header logo sized to sit with the 36px icons on the left */
.app-header .profile-mark {
    gap: 4px;
    font-size: 24px;
}

.app-header .profile-mark .logo-container {
    width: 62px;
    height: 48px;
}

.app-header .profile-mark .logo-container img {
    width: 62px;
    height: 48px;
}

@media (max-width: 400px) {
    .app-header .profile-mark {
        gap: 3px;
        font-size: 21px;
    }

    .app-header .profile-mark .logo-container,
    .app-header .profile-mark .logo-container img {
        width: 52px;
        height: 40px;
    }
}

/* The header's top right shows the app icon; it opens Profile */
.app-header .profile-mark .app-icon {
    width: 44px;
    height: 44px;
    display: block;
    /* A solid picture cut to a rounded square by the page, so no soft edge pixels can show a color */
    border-radius: 11px;
    clip-path: inset(1px round 10px);
    background: transparent;
    filter: none;
    box-shadow: none;
}

/* Profile page: room on both sides, and a way back Home */
.profile-settings {
    padding: 0 12px 24px;
}

.profile-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 9px 14px;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: none;
}

.profile-home svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Profile page: the MotorLogr logo at the top takes you Home */
.profile-page-logo {
    display: flex;
    justify-content: center;
    width: fit-content;
    margin: 0 auto 14px;
    font-size: 24px;
    -webkit-tap-highlight-color: transparent;
}

body.dark-mode .profile-page-logo {
    color: #f3f6fb;
}

/* Profile page: pull the logo up under the header */
.profile-settings {
    margin-top: -4px;
}

.profile-page-logo {
    margin-bottom: 8px;
}

/* Profile page logo: a bit larger */
.profile-page-logo {
    gap: 6px;
    font-size: 30px;
}

.profile-page-logo .logo-container,
.profile-page-logo .logo-container img {
    width: 78px;
    height: 60px;
}

.profile-page-logo {
    margin-bottom: 20px;
}

/* Lease fields inside Edit asset */
.lease-fields {
    display: grid;
    gap: 12px;
    margin: 14px 0;
}

.lease-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.lease-toggle input {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.lease-form-card {
    margin-top: 0;
    gap: 12px;
}

.lease-form-card label {
    display: grid;
    gap: 4px;
}

.lease-edit-hint {
    opacity: 0.7;
    font-size: 0.85rem;
}

/* "This asset is leased": box on the left, text to its right, just above Notes */
.lease-toggle[hidden] {
    display: none;
}

.lease-toggle {
    justify-content: flex-start;
    flex-direction: row;
}

/* Edit asset: room above Save, and it only shows its bright color when there is something to save */
.asset-edit-dialog .asset-edit-form button[type="submit"] {
    margin-top: 12px;
}

.asset-edit-dialog .asset-edit-form button[type="submit"]:disabled {
    background: rgba(127, 127, 127, 0.25);
    border-color: transparent;
    color: rgba(127, 127, 127, 0.9);
    cursor: default;
    opacity: 1;
}

/* Beat the general form rules that stack a label's text under its input */
body .asset-edit-form label.lease-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

body .asset-edit-form label.lease-toggle[hidden] {
    display: none;
}

body .asset-edit-form label.lease-toggle input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-height: 0;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}

body .asset-edit-form label.lease-toggle span {
    flex: 0 1 auto;
}

/* Dark header: the logo drawn straight onto it, with no colored plate behind (so nothing looks like a halo).
   Light header: the logo keeps its dark plate, because its white lettering needs it. */
.app-header .profile-mark .app-icon-cutout {
    display: none;
    clip-path: none;
    border-radius: 0;
}

body.dark-mode .app-header .profile-mark .app-icon-cutout {
    display: block;
}

body.dark-mode .app-header .profile-mark .app-icon-plate {
    display: none;
}

/* Same one-line checkbox in the add-asset screens (they use .asset-form, not .asset-edit-form) */
body .asset-form label.lease-toggle,
body .asset-wizard label.lease-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

body .asset-form label.lease-toggle[hidden],
body .asset-wizard label.lease-toggle[hidden] {
    display: none;
}

body .asset-form label.lease-toggle input[type="checkbox"],
body .asset-wizard label.lease-toggle input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-height: 0;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}

body .asset-form label.lease-toggle span,
body .asset-wizard label.lease-toggle span {
    flex: 0 1 auto;
}

/* Install button in the header, beside the app icon */
button.header-icon.install-app {
    color: var(--primary-color);
}

/* Keep the last item on a page clear of the bottom of the screen (some phones ignore the page's own bottom margin) */
body.assets-view .app-content {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

/* The rent checkbox uses the same one-line style as the lease one */
body .asset-form label.lease-toggle,
body .asset-edit-form label.lease-toggle {
    display: flex;
}

body .asset-form label.lease-toggle[hidden],
body .asset-edit-form label.lease-toggle[hidden] {
    display: none;
}

/* Maintenance list and schedule pop ups: Add and Close are the same solid blue buttons */
#maintenance-maintenance-list-dialog .asset-gallery-open,
#maintenance-schedule-dialog .asset-gallery-open,
#maintenance-maintenance-list-dialog .asset-gallery-close,
#maintenance-schedule-dialog .asset-gallery-close,
body.assets-view:not(.dark-mode) #maintenance-maintenance-list-dialog .asset-gallery-open,
body.assets-view:not(.dark-mode) #maintenance-schedule-dialog .asset-gallery-open,
body.assets-view:not(.dark-mode) #maintenance-maintenance-list-dialog .asset-gallery-close,
body.assets-view:not(.dark-mode) #maintenance-schedule-dialog .asset-gallery-close {
    border: 1px solid #3b91ff;
    background: #287bf0;
    color: #ffffff;
    font-weight: 700;
}

#maintenance-maintenance-list-dialog .asset-gallery-open:hover,
#maintenance-schedule-dialog .asset-gallery-open:hover,
#maintenance-maintenance-list-dialog .asset-gallery-close:hover,
#maintenance-schedule-dialog .asset-gallery-close:hover {
    background: #1f6ad6;
    color: #ffffff;
}

/* The schedule's Add looks exactly like the list's Add */
#maintenance-schedule-dialog .schedule-edit-label.asset-gallery-open {
    padding: 10px 16px;
    font-size: 16px;
    line-height: 1.2;
    border-radius: 6px;
    white-space: nowrap;
}

/* Terms and Privacy links at the bottom of every page, and the pages themselves */
.legal-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 18px 16px 4px;
    font-size: 13px;
    opacity: 0.75;
}

.legal-links a {
    color: inherit;
    text-decoration: underline;
}

body.assets-view .app-content .legal-links {
    padding-bottom: 0;
}

.legal-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 20px 12px;
    line-height: 1.55;
}

.legal-page h1 {
    margin-bottom: 4px;
    font-size: 26px;
}

.legal-page h2 {
    margin: 22px 0 6px;
    font-size: 18px;
}

.legal-page ul {
    margin: 6px 0 6px 20px;
}

.legal-updated,
.legal-note {
    opacity: 0.75;
    font-size: 14px;
}

.legal-note {
    margin-top: 24px;
}

/* Your assets: thumbnails in a grid, with the name under each picture */
body.assets-view .asset-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 14px;
}

body.assets-view .asset-list .asset-empty {
    grid-column: 1 / -1;
}

body.assets-view .asset-list .asset-tile {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
    padding: 0;
    border: 0;
    border-bottom: 0;
    background: transparent;
    box-shadow: none;
    text-align: left;
}

body.assets-view .asset-list .asset-tile:hover,
body.assets-view .asset-list .asset-tile:focus-visible {
    background: transparent;
}

body.assets-view .asset-list .asset-tile .asset-thumbnail {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    margin: 0;
    border-radius: 14px;
    object-fit: cover;
    background: rgba(127, 127, 127, 0.2);
}

body.assets-view .asset-list .asset-tile .asset-row-content {
    min-width: 0;
    padding: 0 2px;
}

body.assets-view .asset-list .asset-tile h3 {
    font-size: 16px;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

body.assets-view .asset-list .asset-tile .asset-details {
    margin: 2px 0 0;
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.8;
}

@media (min-width: 640px) {
    body.assets-view .asset-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 960px) {
    body.assets-view .asset-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* The blank tile with a plus sign that adds another asset */
body.assets-view .asset-list .asset-tile-add {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

body.assets-view .asset-list .asset-tile-add .asset-thumbnail-add {
    display: grid;
    place-items: center;
    border: 2px dashed #3b91ff;
    background: transparent;
    color: #3b91ff;
    font-size: 48px;
    font-weight: 300;
    line-height: 1;
}

body.assets-view .asset-list .asset-tile-add:hover .asset-thumbnail-add {
    background: rgba(59, 145, 255, 0.12);
}

body.assets-view .asset-list .asset-tile-add .asset-add-label {
    display: block;
    color: #3b91ff;
    font-size: 16px;
    font-weight: 700;
}

/* Add asset: a pop up over the page, not a card that scrolls with it */
body.modal-open {
    overflow: hidden;
}

body.assets-view .asset-form-backdrop {
    position: fixed;
    inset: 0;
    z-index: 290;
    background: rgb(0 0 0 / 70%);
}

body.assets-view .asset-form-backdrop[hidden] {
    display: none;
}

body.assets-view .asset-form-card:not([hidden]) {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 300;
    width: min(620px, calc(100% - 28px));
    max-height: min(92dvh, 900px);
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-shadow: 0 24px 60px rgb(0 0 0 / 55%);
}

body.assets-view:not(.dark-mode) .asset-form-card:not([hidden]) {
    background: #ffffff;
}

/* Asset thumbnails: a colored border, picked per asset (Edit asset) from the logo's colors */
body.assets-view .asset-list .asset-tile .asset-thumbnail:not(.asset-thumbnail-add) {
    border: 3px solid var(--tile-color, #1e90ff);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

/* Hold an asset to drag it around the grid */
body.assets-view .asset-list .asset-tile[data-asset-id] {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

body.asset-reordering {
    cursor: grabbing;
    overflow: hidden;
}

body.assets-view .asset-list .asset-tile.asset-dragging {
    opacity: 0.35;
}

.asset-ghost {
    position: fixed;
    z-index: 400;
    margin: 0;
    pointer-events: none;
    transform: scale(1.05);
    opacity: 0.95;
    filter: drop-shadow(0 14px 22px rgb(0 0 0 / 55%));
}

.asset-ghost .asset-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    object-fit: cover;
    border: 3px solid var(--tile-color, #1e90ff);
    display: block;
}

.asset-ghost .asset-row-content {
    padding: 6px 2px 0;
    color: #f3f6fb;
}

.asset-ghost h3 {
    font-size: 16px;
}

.asset-ghost .asset-details {
    font-size: 13px;
}

/* Border color choices in Edit asset */
.border-color-picker {
    margin: 14px 0;
    padding: 0;
    border: 0;
}

.border-color-picker legend {
    margin-bottom: 8px;
    padding: 0;
    font-weight: 600;
}

.border-color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.border-color-option {
    position: relative;
    display: block;
    cursor: pointer;
}

.border-color-option input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.border-color-swatch {
    display: block;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 3px solid var(--swatch);
    background: transparent;
    box-shadow: inset 0 0 0 4px var(--swatch);
}

.border-color-option input:checked + .border-color-swatch {
    outline: 3px solid #f3f6fb;
    outline-offset: 3px;
}

body.assets-view:not(.dark-mode) .border-color-option input:checked + .border-color-swatch {
    outline-color: #1e293b;
}

.assets-hero-hint {
    margin-top: 8px;
    font-size: 14px;
    opacity: 0.8;
}

/* "Automatic" border color: the three colors in turn */
.border-color-auto {
    border-color: transparent;
    background: conic-gradient(#ff7a1a 0 33%, #1e90ff 0 66%, #ffb02e 0);
    box-shadow: none;
}

/* The colored frame goes around the picture and the name under it */
body.assets-view .asset-list .asset-tile[data-asset-id] {
    gap: 0;
    overflow: hidden;
    border: 3px solid var(--tile-color, #1e90ff);
    border-radius: 16px;
    background: rgba(127, 127, 127, 0.08);
}

body.assets-view .asset-list .asset-tile[data-asset-id] .asset-thumbnail:not(.asset-thumbnail-add) {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

body.assets-view .asset-list .asset-tile[data-asset-id] .asset-row-content {
    padding: 8px 10px 10px;
}

.asset-ghost.asset-tile {
    overflow: hidden;
    border: 3px solid var(--tile-color, #1e90ff);
    border-radius: 16px;
    background: #111d29;
}

.asset-ghost.asset-tile .asset-thumbnail {
    border: 0;
    border-radius: 0;
}

.asset-ghost.asset-tile .asset-row-content {
    padding: 8px 10px 10px;
}

/* The chosen border color must be obvious on every phone: a ring (not an outline) and a check mark */
.border-color-swatch {
    position: relative;
}

.border-color-option input:checked + .border-color-swatch {
    outline: 0;
    box-shadow: inset 0 0 0 4px var(--swatch), 0 0 0 3px #111d29, 0 0 0 6px #f3f6fb;
}

.border-color-option input:checked + .border-color-swatch::after {
    content: "\2713";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    text-shadow: 0 0 3px rgb(0 0 0 / 80%), 0 0 6px rgb(0 0 0 / 60%);
}

body.assets-view:not(.dark-mode) .border-color-option input:checked + .border-color-swatch {
    box-shadow: inset 0 0 0 4px var(--swatch), 0 0 0 3px #ffffff, 0 0 0 6px #1e293b;
}

/* Pick a frame color from a photo */
.border-color-option[hidden] {
    display: none;
}

.photo-color-panel {
    margin-top: 10px;
    display: grid;
    gap: 10px;
}

.photo-color-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.photo-color-photo {
    width: 64px;
    height: 64px;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 10px;
    background: none;
    overflow: hidden;
    cursor: pointer;
}

.photo-color-photo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.photo-color-photo.is-chosen {
    border-color: #f3f6fb;
}

.photo-color-found {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.photo-color-found-swatch {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 3px solid rgba(127, 127, 127, 0.5);
    border-radius: 50%;
    background: var(--swatch);
    cursor: pointer;
}

.photo-color-found-swatch.is-chosen {
    border-color: #f3f6fb;
    box-shadow: 0 0 0 3px var(--swatch);
}

/* The plus tile is the same size and shape as the asset tiles: dashed frame around the plus and its label */
body.assets-view .asset-list .asset-tile.asset-tile-add {
    gap: 0;
    overflow: hidden;
    border: 3px dashed #3b91ff;
    border-radius: 16px;
    background: transparent;
}

body.assets-view .asset-list .asset-tile-add .asset-thumbnail-add {
    border: 0;
    border-radius: 0;
    background: transparent;
}

body.assets-view .asset-list .asset-tile.asset-tile-add .asset-row-content {
    padding: 8px 10px 10px;
}

body.assets-view .asset-list .asset-tile-add:hover {
    background: rgba(59, 145, 255, 0.1);
}

/* The form's general button style (solid blue, padded) was painting over these: use stronger selectors */
.asset-form button.photo-color-photo {
    width: 64px;
    height: 64px;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 10px;
    background: transparent;
    overflow: hidden;
}

.asset-form button.photo-color-photo.is-chosen {
    border-color: #f3f6fb;
}

.asset-form button.photo-color-found-swatch {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 3px solid rgba(127, 127, 127, 0.5);
    border-radius: 50%;
    background: var(--swatch);
}

.asset-form button.photo-color-found-swatch.is-chosen {
    border-color: #f3f6fb;
    box-shadow: 0 0 0 3px var(--swatch);
}

body.assets-view:not(.dark-mode) .asset-form button.photo-color-photo.is-chosen,
body.assets-view:not(.dark-mode) .asset-form button.photo-color-found-swatch.is-chosen {
    border-color: #1e293b;
}

/* Space between the color choices and the "Pick a color from a photo" button */
.border-color-picker [data-photo-color-open] {
    margin-top: 18px;
}

/* On an asset's own page, the borders take that asset's color (--asset-color, set on the page) */
.asset-detail-page .asset-gallery-link,
.asset-detail-page .asset-gallery-open,
.asset-detail-page .asset-gallery-close,
.asset-detail-page .asset-document-submit,
.asset-detail-page .asset-document-download,
.asset-detail-page .photo-picker-button,
.asset-detail-page .asset-profile-select,
.asset-detail-page .asset-gallery-dialog,
.asset-detail-page .asset-gallery-item,
.asset-detail-page .asset-carousel-slide,
.asset-detail-page .recent-row,
.asset-detail-page .maintenance-row,
.asset-detail-page .record-card,
.asset-detail-page .mileage-row,
.asset-detail-page .schedule-item,
.asset-detail-page .asset-documents-dropdown > summary,
.asset-detail-page .lease-card:not(.lease-watch):not(.lease-over),
.asset-detail-page .next-due-fields,
.asset-detail-page input:not([type="radio"]):not([type="checkbox"]),
.asset-detail-page select,
.asset-detail-page textarea,
.asset-detail-page .asset-gallery-dialog-header {
    border-color: var(--asset-color, #3b91ff) !important;
}

.asset-detail-page .asset-gallery-dialog::backdrop {
    background: rgb(0 0 0 / 70%);
}

/* Add asset tile: label centered under the plus sign */
body.assets-view .asset-list .asset-tile.asset-tile-add {
    text-align: center;
}

body.assets-view .asset-list .asset-tile.asset-tile-add .asset-row-content {
    width: 100%;
    display: flex;
    justify-content: center;
    text-align: center;
}

body.assets-view .asset-list .asset-tile-add .asset-add-label {
    width: 100%;
    text-align: center;
}

/* Add asset tile: plus and label are stacked together inside the dashed block */
body.assets-view .asset-list .asset-tile-add .asset-thumbnail-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

body.assets-view .asset-list .asset-tile-add .asset-add-plus {
    font-size: 48px;
    font-weight: 300;
    line-height: 1;
}

body.assets-view .asset-list .asset-tile-add .asset-add-label {
    width: auto;
    font-size: 16px;
    line-height: 1.2;
}

/* Email link on the Support page uses the app's normal blue */
.legal-page a {
    color: #3b91ff;
}

/* VIN box and its Paste button share one row */
.vin-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-top: 6px;
}

.vin-row input {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    margin: 0;
}

.vin-row .vin-paste,
.asset-form .vin-row button.vin-paste {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    padding: 0 16px;
}

/* Smaller VIN block: a VIN is 17 characters, so the box does not need the full width */
.vin-block .vin-row,
.vin-scan .vin-row {
    justify-content: flex-start;
}

.vin-block .vin-row input,
.vin-scan .vin-row input {
    flex: 0 1 260px;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 15px;
}

.vin-block .vin-row .vin-paste,
.vin-scan .vin-row .vin-paste {
    padding: 6px 14px;
    font-size: 14px;
}

.vin-block .vin-scan .odometer-label {
    font-size: 13px;
}

.vin-block .vin-scan .photo-picker-button {
    padding: 6px 10px;
    font-size: 14px;
}

.vin-block .vin-scan .asset-photo-controls {
    gap: 6px;
}

/* Search icon inside the VIN box */
.vin-row .vin-field {
    position: relative;
    flex: 0 1 260px;
    display: block;
}

.vin-row .vin-field input {
    width: 100%;
    padding-right: 40px;
}

.vin-block .vin-row .vin-field input {
    flex: none;
}

.asset-form .vin-field button.vin-search,
.vin-field .vin-search {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #3b91ff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.vin-field .vin-search svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* The Assets icon is blue on every page, not only when it is the current one */
.header-icon,
.header-icon.active {
    color: var(--primary-color);
}

.header-icon.header-icon-maintenance,
.header-icon.header-icon-maintenance.active {
    color: #f58a1f;
}

/* Footer links: Terms and Privacy on one row, Support and the home link on the next */
.legal-links {
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.legal-links .legal-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.home-page .home-footer-legal {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* The footer links now close every page, so less empty space is needed under the content */
body.assets-view .app-content {
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.asset-detail-page {
    margin-bottom: 8px;
}

body.assets-view .app-content .legal-links {
    padding-bottom: 12px;
}

.header-username {
    align-self: center;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
    color: inherit;
    text-decoration: none;
}

.link-button {
    background: none;
    border: 0;
    padding: 0 0.25rem;
    font: inherit;
    font-size: 0.85rem;
    color: #1a73e8;
    cursor: pointer;
}
.username-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.username-inline input {
    flex: 1 1 10rem;
    min-width: 0;
}

.header-username {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    line-height: 1.15;
    max-width: 9rem;
    margin-right: 0.15rem;
    text-decoration: none;
    cursor: default;
}
.header-username small {
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.65;
}
.header-username strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 600;
}

.icon-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 6px;
    padding: 0;
    vertical-align: middle;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
}
.icon-edit:hover { background: rgba(26, 115, 232, 0.12); }
.icon-edit svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.username-inline .save-preferences {
    margin-top: 0;
    padding: 8px 14px;
}

.header-username {
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.3rem;
    max-width: 11rem;
}
.header-username small {
    font-size: 0.85rem;
    letter-spacing: 0;
    text-transform: none;
}
.header-username strong { min-width: 0; }

.username-inline .save-preferences {
    box-sizing: border-box;
    min-width: 5.5rem;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--primary-color);
    line-height: 1;
}
.username-inline .save-preferences:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.profile-details dd.username-dd.editing { flex: 1 1 100%; }
.username-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}
.username-inline[hidden] { display: none; }
.username-inline input {
    grid-column: 1 / -1;
    width: 100%;
    box-sizing: border-box;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #94a3b8;
    border-radius: 6px;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    font-weight: 400;
}
body.dark-mode .username-inline input { background: #0f172a; color: #e2e8f0; border-color: #475569; }
.username-inline .save-preferences {
    width: 100%;
    min-width: 0;
    height: 42px;
    margin: 0;
    padding: 0 14px;
    box-sizing: border-box;
    border: 1px solid var(--primary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.vin-suggestions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.vin-suggestions .save-preferences { width: auto; height: auto; padding: 0.4rem 0.7rem; font-family: ui-monospace, monospace; font-size: 0.85rem; letter-spacing: 0.02em; }

.vin-found-label { font-weight: 600; }
.vin-found-name { display: inline; color: var(--primary-color); font-size: 1.2em; font-weight: 700; }
.vin-found-check { display: block; margin-top: 0.15rem; }

.button-spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: 0.55em;
    vertical-align: -0.15em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: button-spin 0.7s linear infinite;
}
@keyframes button-spin { to { transform: rotate(360deg); } }
.asset-wizard.is-saving { cursor: progress; }
.asset-wizard.is-saving .asset-submit:disabled { opacity: 0.85; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .button-spinner { animation-duration: 2s; } }

/* Asset tiles in normal (light) mode: the name and details sit on a light card, so they need dark text. */
body.assets-view:not(.dark-mode) .asset-list .asset-tile h3 {
    color: #1e293b;
}

body.assets-view:not(.dark-mode) .asset-list .asset-tile .asset-details {
    color: #64748b !important;
}

.vin-progress {
    display: block;
    width: 100%;
    height: 8px;
    margin-top: 8px;
    border: 0;
    border-radius: 4px;
    overflow: hidden;
    appearance: none;
    background: rgba(127, 127, 127, 0.25);
    accent-color: var(--primary-color);
}
.vin-progress::-webkit-progress-bar { background: rgba(127, 127, 127, 0.25); }
.vin-progress::-webkit-progress-value { background: var(--primary-color); transition: width 0.15s ease; }
.vin-progress::-moz-progress-bar { background: var(--primary-color); }

/* The form's general input rules (full width, padding, border) must not stretch the hidden file inputs;
   at full width they stick out of the card and give it a sideways scrollbar. */
.asset-form input.visually-hidden {
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    border: 0 !important;
}

/* Pop-ups have rounded corners, so a full-height square scrollbar track covers them on the right.
   Chrome and Safari: a slim track that stops short of the corners. (Firefox keeps its own thin bar.) */
@supports selector(::-webkit-scrollbar) {
    body dialog.asset-gallery-dialog {
        scrollbar-width: auto;
        scrollbar-color: auto;
    }

    .asset-gallery-dialog::-webkit-scrollbar {
        width: 14px;
    }

    .asset-gallery-dialog::-webkit-scrollbar-track {
        margin: 16px 0;
        background: transparent;
    }

    .asset-gallery-dialog::-webkit-scrollbar-thumb {
        border: 4px solid transparent;
        border-radius: 8px;
        background: rgba(127, 127, 127, 0.55);
        background-clip: padding-box;
    }

    .asset-gallery-dialog::-webkit-scrollbar-thumb:hover {
        background: rgba(127, 127, 127, 0.8);
        background-clip: padding-box;
    }
}

/* Fuel fill-ups in the Log miles box, the timeline and the Miles card */
.fuel-block { display: grid; gap: 12px; }
.fuel-block[hidden], .fuel-fields[hidden] { display: none; }
.fuel-fields { display: grid; gap: 12px; }
.fuel-hint { margin: 0; font-size: 0.85rem; opacity: 0.75; }
.mileage-row-fuel { display: block; margin-top: 2px; font-size: 0.9rem; }
.mileage-row-fuel strong { color: var(--primary-color); }
.fuel-summary { margin: 4px 0 0; }
.fuel-summary strong { color: var(--primary-color); font-size: 1.1em; }
.fuel-summary-more { opacity: 0.8; }

/* The fill-up checkbox sits beside its words, like the lease checkbox does */
body .asset-document-form label.fuel-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}
body .asset-document-form label.fuel-toggle input[type="checkbox"] {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    margin: 0;
    padding: 0;
}
body .asset-document-form label.fuel-toggle span {
    color: inherit;
    font-size: 1rem;
    font-weight: 600;
}

/* Log miles: one column, every field on its own line, so the fuel fields line up with the rest */
#mileage-log-dialog .asset-document-form {
    grid-template-columns: minmax(0, 1fr);
}

#mileage-log-dialog .asset-document-form > * {
    grid-column: 1 / -1;
}

#mileage-log-dialog .asset-document-form .asset-document-submit {
    justify-self: start;
}

/* Schedule button: a calendar with a clock, then the count. No word, so it sits beside "Maintenance"
   on the smallest phones without the two running into each other. */
.schedule-button {
    gap: 8px;
    padding-top: 5px;
    padding-bottom: 5px;
}

.schedule-button .schedule-icon {
    flex: 0 0 auto;
}

/* "Add" buttons on the asset page are a plus icon */
.asset-gallery-open .plus-icon {
    display: block;
    flex: 0 0 auto;
}

/* "Add modification" button: a wrench crossed with a pencil, in the button's own color */
.asset-gallery-open .mod-icon {
    display: block;
    flex: 0 0 auto;
}

/* Same height as the plus buttons beside the other cards */
.asset-gallery-open:has(.mod-icon) {
    padding-top: 5px;
    padding-bottom: 5px;
}

/* ==== TRY-OUT: the nav bar lives at the bottom instead of the top ====
   The page is sized from --header-height and --footer-height, so moving the bar is a matter of
   swapping the two. To go back to the top header, delete everything from this comment down. */
:root,
body,
body.assets-view {
    --header-height: 0px !important;
    --footer-height: 52px !important;
}

.app-header,
body.assets-view .app-header {
    top: auto;
    bottom: 0;
    height: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px));
    padding: 0 clamp(14px, 4vw, 40px) env(safe-area-inset-bottom, 0px);
    border-bottom: 0;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.12);
}

body.assets-view .app-header,
body.dark-mode .app-header {
    border-top-color: #263443;
}

body.assets-view:not(.dark-mode) .app-header {
    border-top-color: #e2e8f0;
}

/* Pages that scroll the whole window need room above the bar so the last thing isn't hidden */
.app-content {
    margin-bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px));
}

body.assets-view .app-content {
    margin-bottom: 0;
}

body .home-page .hero {
    min-height: max(600px, calc(100dvh - var(--footer-height)));
}

/* The MotorLogr logo button sits in the middle of the bar, a little bigger; icons left, install and name right */
.app-header,
body.assets-view .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.app-header .header-nav-left {
    justify-self: start;
}

.app-header .header-nav-right {
    justify-self: end;
    min-width: 0;
    max-width: 100%;
}

.app-header .profile-mark {
    justify-self: center;
}

.app-header .header-username {
    flex: 0 1 auto;
    min-width: 0;
    max-width: none;
}

.app-header .header-username strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 400px) {
    /* Little room beside the logo: drop the word "Welcome" and keep the name */
    .app-header .header-username small {
        display: none;
    }
}

/* The logo pops up out of the middle of the bar: a bigger rounded badge that rises above the bar's top edge */
.app-header .profile-mark {
    position: relative;
    width: 64px;
    height: var(--footer-height);
    overflow: visible;
}

.app-header .profile-mark .app-icon {
    position: absolute;
    left: 0;
    top: -24px;
    width: 64px;
    height: 64px;
    padding: 1px;
    border: 3px solid #08111a;
    border-radius: 18px;
    background: #08111a;
    clip-path: none;
    object-fit: contain;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.35);
}

/* Light mode: the badge ring matches the white bar; the dark plate fills the circle */
body:not(.dark-mode) .app-header .profile-mark .app-icon {
    border-color: #ffffff;
    padding: 0;
    background: #ffffff;
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.22);
}

/* Pages scroll to the bar's top edge, so leave room for the badge above it */
body.assets-view .app-content {
    padding-bottom: 24px;
}

.app-content {
    padding-bottom: 36px;
}

/* ==== Profile pictures: a photo, or a white icon on a colored circle ==== */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.avatar svg {
    width: 58%;
    height: 58%;
    display: block;
}

/* Bottom bar: the avatar opens Profile */
.header-avatar {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    margin-left: 4px;
    border-radius: 50%;
    text-decoration: none;
    outline-offset: 2px;
}

.header-avatar .avatar {
    box-shadow: 0 0 0 2px var(--primary-color);
}

/* Profile page */
.avatar-current {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 4px 0 8px;
}

.avatar-large {
    width: 88px;
    height: 88px;
}

.avatar-actions {
    display: grid;
    gap: 8px;
    justify-items: start;
}

.avatar-actions form {
    margin: 0;
}

.avatar-hint {
    margin: 14px 0 8px;
    font-weight: 600;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 10px;
}

.avatar-choice {
    display: grid;
    place-items: center;
    padding: 3px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.avatar-choice .avatar {
    width: 100%;
    max-width: 52px;
    height: auto;
    aspect-ratio: 1;
}

.avatar-choice:hover,
.avatar-choice:focus-visible {
    border-color: rgba(127, 127, 127, 0.55);
}


/* "Add another service at these miles" sits beside its box like the fuel fill-up one, and the note above the steps */
body .asset-document-form label.visit-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.visit-note {
    margin: 0 0 8px;
    color: var(--primary-color);
    font-weight: 600;
}

/* The Miles card shows the reading like an odometer: dark rollers, white digits, leading zeros dimmed */
.odometer-block {
    margin: 12px 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.odometer {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 6px 8px;
    border: 2px solid #3a4452;
    border-radius: 10px;
    background: #090d12;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.1);
    font-size: 1.45rem;
}

.odo-digit {
    position: relative;
    display: block;
    width: 1.15em;
    height: 1.6em;
    overflow: hidden;
    border-radius: 3px;
    background: linear-gradient(#1c232c, #0d1217 50%, #1c232c);
    color: #f7f7f2;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
    font-weight: 700;
    line-height: 1.6em;
    text-align: center;
}

/* The curve of the roller: darker at the top and bottom */
.odo-digit::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.65), transparent 30%, transparent 70%, rgba(0, 0, 0, 0.65));
    pointer-events: none;
}

.odo-strip {
    display: flex;
    flex-direction: column;
    transform: translateY(calc(var(--d) * -1.6em));
    transition: transform 1.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    transition-delay: calc(var(--i) * 70ms);
}

.odo-strip span {
    display: block;
    height: 1.6em;
}

.odo-zero {
    color: #6b7684;
}

.odo-gap {
    width: 5px;
}

.odo-unit {
    font-weight: 700;
    letter-spacing: 0.04em;
}

.odometer-block .odo-asof {
    flex: 1 1 100%;
    opacity: 0.75;
    font-size: 0.85rem;
}

/* The odometer that mirrors what is typed in a miles box */
.odo-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: -2px 0 6px;
}

.odo-live {
    font-size: 1.15rem;
}

.odo-live.odo-low {
    border-color: #ef4444;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 0 2px rgba(239, 68, 68, 0.35);
}

.odo-note {
    flex: 1 1 100%;
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.8;
}

.odo-note:empty {
    display: none;
}

.odo-note.odo-low-note {
    color: #f87171;
    font-weight: 600;
    opacity: 1;
}

body:not(.dark-mode) .odo-note.odo-low-note {
    color: #b91c1c;
}

/* The odometer is the miles box: the real input lies invisibly over it, and the odometer lights up when typing */
.odo-row {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.odo-row input[data-odometer-input] {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: transparent !important;
    caret-color: transparent !important;
    opacity: 0.01 !important;
    font-size: 16px !important;
    cursor: text;
}

.odo-input:focus-within .odo-live {
    border-color: var(--primary-color);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 0 3px rgba(59, 145, 255, 0.4);
}

.odo-input:focus-within .odo-live.odo-low {
    border-color: #ef4444;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 0 3px rgba(239, 68, 68, 0.45);
}

/* Maintenance form: Back, Add another service and Save stay on one row, even on a small phone. */
.wishlist-step-nav { flex-wrap: nowrap; gap: 8px; }
.wishlist-step-nav > button { flex: 0 1 auto; min-width: 0; padding-left: 12px; padding-right: 12px; white-space: nowrap; }
.wishlist-step-nav > [data-md-more] { flex: 1 1 auto; }

/* In the two-column add forms the odometer (and the odometer picture buttons) take the whole row, on the left */
.asset-document-form > .odo-input,
.asset-document-form > .odometer-reader {
    grid-column: 1 / -1;
}

/* Engines and generators */
.engine-fields { display: grid; gap: 10px; margin-top: 12px; }
.component-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.component-row { display: grid; gap: 6px; padding: 12px; border: 1px solid #263443; border-radius: 8px; }
.component-main { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.component-details, .component-asof { opacity: 0.75; font-size: 0.85rem; }
.component-hours-value { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.component-more summary { cursor: pointer; font-size: 0.9rem; opacity: 0.85; }
.component-more > * { margin-top: 10px; }
.component-history { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 0.9rem; }
.component-history li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.component-history-label { opacity: 0.7; }
.component-edit { display: grid; gap: 10px; }
.component-remove { color: #ef4444; }
body:not(.dark-mode) .component-row { border-color: #dbe4ee; }

/* Drop-down lists follow the theme: dark list in dark mode, light list in light mode (they were mixed). */
body.dark-mode select,
body.dark-mode dialog select {
    color-scheme: dark;
}

body.dark-mode select option {
    background: #0b1520;
    color: #dce7f4;
}

body:not(.dark-mode) select,
body:not(.dark-mode) dialog select,
body.assets-view:not(.dark-mode) .asset-form select {
    color-scheme: light;
}

body:not(.dark-mode) select option {
    background: #ffffff;
    color: #1e293b;
}

/* The rename form inside an engine's settings: the usual form fields, without the dialog form's box */
.component-edit.asset-document-form {
    grid-template-columns: 1fr;
    margin: 10px 0 0;
    padding: 0;
    border: 0;
    background: none;
}
.component-remove { width: 100%; }

/* Engine and generator tabs */
.component-tabs { display: flex; gap: 6px; margin: 14px 0 12px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.component-tab { flex: 0 0 auto; padding: 8px 14px; border: 1px solid #465669; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 0.9rem; cursor: pointer; white-space: nowrap; }
.component-tab.active { background: var(--primary-color, #2563eb); border-color: var(--primary-color, #2563eb); color: #fff; font-weight: 700; }
body:not(.dark-mode) .component-tab { border-color: #cbd5e1; }
.component-panel { display: grid; gap: 10px; min-width: 0; }
.component-panel[hidden] { display: none; }
.component-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.component-subhead { margin: 6px 0 0; font-size: 1rem; }
.component-summary { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.component-summary-row { display: grid; gap: 3px; padding: 12px; border: 1px solid #263443; border-radius: 8px; }
body:not(.dark-mode) .component-summary-row { border-color: #dbe4ee; }
.component-summary-row.due-overdue { border-color: #ef4444; }
.component-summary-row.due-soon { border-color: #f59e0b; }
.component-summary-name { justify-self: start; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.component-summary-hours strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.component-summary-line, .component-summary-due { font-size: 0.88rem; opacity: 0.8; }
.component-summary-row.due-overdue .component-summary-due { color: #ef4444; opacity: 1; }
.component-summary-row.due-soon .component-summary-due { color: #f59e0b; opacity: 1; }
.component-section { overflow-x: hidden; }
.component-history a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* Engine tabs wrap onto more rows instead of scrolling sideways */
.component-tabs { flex-wrap: wrap; overflow: visible; padding-bottom: 0; }
.component-tab { white-space: normal; }

/* Engine tabs: one row that swipes sideways, with no scroll bar showing */
.component-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -ms-overflow-style: none; }
.component-tabs::-webkit-scrollbar { display: none; }
.component-tab { white-space: nowrap; }

/* Spare parts: footer icon and the warehouse page */
.header-icon.header-icon-parts,
.header-icon.header-icon-parts.active {
    color: #14b8a6;
}

.parts-bar { display: flex; gap: 10px; align-items: center; }
.parts-bar .asset-gallery-open { display: inline-flex; align-items: center; gap: 8px; }
.parts-filter { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin: 12px 0 4px; }
.parts-filter input, .parts-filter select {
    min-width: 0; padding: 11px 14px; border: 1px solid #465669; border-radius: 8px;
    background: rgba(10, 18, 27, 0.32); color: inherit; font: inherit;
}
body:not(.dark-mode) .parts-filter input, body:not(.dark-mode) .parts-filter select { background: #fff; border-color: #cbd5e1; color: #1e293b; }
.parts-group[hidden], .part-card[hidden] { display: none; }
.parts-location { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: 1.05rem; }
.parts-location svg { color: #14b8a6; flex: none; }
.parts-list { display: grid; gap: 10px; }
.part-card {
    display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center;
    width: 100%; padding: 10px 12px; border: 1px solid #263443; border-radius: 10px;
    background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
body:not(.dark-mode) .part-card { border-color: #dbe4ee; }
.part-thumb { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; display: block; }
.part-thumb-empty { display: grid; place-items: center; background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.part-main { display: grid; gap: 3px; min-width: 0; }
.part-name { font-weight: 700; overflow-wrap: anywhere; }
.part-number { font-size: 0.85rem; opacity: 0.75; }
.part-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.part-tag { padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; background: rgba(20, 184, 166, 0.18); color: #14b8a6; }
.part-qty { font-weight: 700; font-size: 1.05rem; opacity: 0.85; }
.part-fits { border: 1px solid #263443; border-radius: 8px; padding: 10px 12px; display: grid; gap: 6px; min-width: 0; }
body:not(.dark-mode) .part-fits { border-color: #dbe4ee; }
.part-fits legend { padding: 0 6px; font-size: 12px; font-weight: 700; opacity: 0.8; }
.part-fit { display: flex !important; align-items: center; gap: 8px; }
.part-fit input { width: auto !important; }
.part-fit-sub { margin-left: 22px; }
.part-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.part-pick .fuel-hint { flex: 1 1 100%; margin: 0; overflow-wrap: anywhere; }
.part-pick .fuel-hint:empty { display: none; }
.part-pick label.photo-picker-button { cursor: pointer; }
.part-photos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.part-photo { margin: 0; display: grid; gap: 6px; justify-items: start; }
.part-photo img { max-width: 100%; max-height: 220px; border-radius: 8px; display: block; }
.part-facts { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.part-facts a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.part-receipt { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.asset-parts-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.asset-parts-list a { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; color: inherit; text-decoration: none; padding: 8px 10px; border: 1px solid #263443; border-radius: 8px; }
body:not(.dark-mode) .asset-parts-list a { border-color: #dbe4ee; }
.asset-part-where { opacity: 0.75; font-size: 0.88rem; }
.parts-page > .parts-filter,
.parts-page > #parts-groups,
.parts-page > .form-error {
    margin-left: clamp(24px, 5vw, 64px);
    margin-right: clamp(24px, 5vw, 64px);
}
.parts-page > #parts-groups { margin-top: 4px; }
.part-pick label.photo-picker-button { display: inline-flex; align-items: center; justify-content: center; position: relative; min-height: 44px; }
.part-fits { gap: 10px; }
.part-fit input[type="checkbox"] { width: 18px !important; height: 18px; flex: none; margin: 0; }
.part-fit-sub { margin-left: 26px; }

/* Terms, Privacy and Support always sit at the bottom, just above the bar and the logo: at the end of a long page,
   and at the bottom of the screen on a short one. */
.app-content {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-height: calc(100vh - var(--footer-height) - env(safe-area-inset-bottom, 0px));
    min-height: calc(100dvh - var(--footer-height) - env(safe-area-inset-bottom, 0px));
}

.app-content > * {
    flex: 0 0 auto;
}

.app-content > .legal-links,
body.assets-view .app-content > .legal-links {
    margin-top: auto;
    padding-top: 24px;
}

body.assets-view .app-content {
    min-height: 0;
    height: calc(100vh - var(--header-height) - var(--footer-height) - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - var(--header-height) - var(--footer-height) - env(safe-area-inset-bottom, 0px));
}

/* Pages with their own full-height wrapper (like Login) share the space with the links instead of pushing them off screen */
.app-content > .auth-page {
    min-height: 0 !important;
    flex: 1 0 auto;
}

/* Storage places */
.part-place { display: grid; gap: 10px; }
.part-new-place[hidden] { display: none; }
.place-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.place-row { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid #263443; border-radius: 8px; }
body:not(.dark-mode) .place-row { border-color: #dbe4ee; }
.place-rename { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.place-rename input { min-width: 0; padding: 10px 12px; border: 1px solid #465669; border-radius: 8px; background: rgba(10, 18, 27, 0.32); color: inherit; font: inherit; }
body:not(.dark-mode) .place-rename input { background: #fff; border-color: #cbd5e1; color: #1e293b; }
.place-count { font-size: 0.85rem; opacity: 0.75; }
.parts-bar { flex-wrap: wrap; }

/* Multi-select drop-down for "What it fits" */
.part-fits-label { font-size: 12px; font-weight: 700; color: #a9b8ca; }
body:not(.dark-mode) .part-fits-label { color: #64748b; }
.multi { position: relative; margin-top: 6px; }
.multi-box { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 6px 12px; border: 1px solid #465669; border-radius: 8px; background: rgba(10, 18, 27, 0.32); cursor: pointer; }
body:not(.dark-mode) .multi-box { background: #fff; border-color: #cbd5e1; }
.multi-box:focus-visible { outline: 2px solid var(--primary-color, #2563eb); outline-offset: 1px; }
.multi-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; flex: 1 1 auto; }
.multi-placeholder { flex: 1 1 auto; opacity: 0.6; }
.multi-placeholder[hidden] { display: none; }
.multi-caret { opacity: 0.7; flex: none; }
.multi-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; font-size: 0.85rem; background: rgba(20, 184, 166, 0.2); color: #14b8a6; max-width: 100%; overflow-wrap: anywhere; }
.multi-chip-x { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 1.05rem; line-height: 1; cursor: pointer; }
.multi-chip-x:hover { background: rgba(20, 184, 166, 0.3); }
.multi-panel { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow-y: auto; padding: 8px; border: 1px solid #465669; border-radius: 8px; background: #0f1b28; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35); }
body:not(.dark-mode) .multi-panel { background: #fff; border-color: #cbd5e1; box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18); }
.multi-panel[hidden] { display: none; }
.multi-group { margin: 6px 4px 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.65; }
.multi-option { display: flex !important; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 6px; cursor: pointer; }
.multi-option:hover { background: rgba(148, 163, 184, 0.15); }
.multi-option input[type="checkbox"] { width: 18px !important; height: 18px; flex: none; margin: 0; }
.multi-sub { margin-left: 22px; }
.part-fits { border: 0; padding: 0; gap: 0; }
.multi-placeholder { text-align: left; }
.multi-cat { padding-bottom: 4px; border-bottom: 1px solid rgba(148, 163, 184, 0.2); }
.multi-cat:last-child { border-bottom: 0; }
.multi-cat-head { font-weight: 700; }
.multi-cat-head em { margin-left: auto; font-style: normal; font-size: 0.75rem; font-weight: 400; opacity: 0.6; }

/* Dark mode: scroll bars and check boxes in pop-ups and lists are dark too, not white */
body.dark-mode dialog,
body.dark-mode .multi-panel,
body.dark-mode .multi-box,
body.dark-mode .app-content {
    color-scheme: dark;
    scrollbar-color: #465669 transparent;
}

body.dark-mode input[type="checkbox"],
body.dark-mode input[type="radio"] {
    accent-color: #3b91ff;
    color-scheme: dark;
}

body.dark-mode .multi-panel::-webkit-scrollbar,
body.dark-mode dialog::-webkit-scrollbar { width: 10px; }
body.dark-mode .multi-panel::-webkit-scrollbar-track,
body.dark-mode dialog::-webkit-scrollbar-track { background: transparent; }
body.dark-mode .multi-panel::-webkit-scrollbar-thumb,
body.dark-mode dialog::-webkit-scrollbar-thumb { background: #465669; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }

/* Our own "this is needed" message under a field */
.field-invalid input, .field-invalid select, .field-invalid textarea { border-color: #ef4444 !important; box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25); }
.field-error-text { color: #ef4444; font-size: 0.88rem; font-weight: 600; }
body:not(.dark-mode) .field-error-text { color: #b91c1c; }
.asset-document-form label > .field-error-text,
.parts-page .field-error-text,
dialog .field-error-text { color: #f87171; font-size: 0.88rem; font-weight: 600; }
body:not(.dark-mode) .asset-document-form label > .field-error-text,
body:not(.dark-mode) dialog .field-error-text { color: #b91c1c; }

/* The logo badge pokes up above the bottom bar, so the footer links keep well clear of it */
.app-content,
body.assets-view .app-content {
    padding-bottom: 60px;
}

.app-content > .legal-links,
body.assets-view .app-content > .legal-links {
    padding-bottom: 0;
}

.home-footer {
    padding-bottom: 64px;
}
.home-page footer.home-footer { padding-bottom: 72px; }

/* Spare parts: each storage place is a card, and the parts in it are smaller boxes */
.parts-group {
    margin: 16px 0 0;
    padding: 14px;
    border: 1px solid #263443;
    border-radius: 14px;
    background: rgba(148, 163, 184, 0.06);
}
body:not(.dark-mode) .parts-group { border-color: #dbe4ee; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); }
.parts-location { margin: 0 0 12px; }
.parts-location-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.parts-count { flex: none; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: rgba(20, 184, 166, 0.18); color: #14b8a6; }
.parts-list { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.part-card {
    position: relative;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 8px;
    padding: 8px;
    border-radius: 10px;
    background: rgba(8, 17, 26, 0.45);
}
body:not(.dark-mode) .part-card { background: #f8fafc; }
.part-card .part-thumb { width: 100%; height: auto; aspect-ratio: 4 / 3; }
.part-card .part-main { padding: 0 2px 2px; }
.part-card .part-name { font-size: 0.92rem; line-height: 1.25; }
.part-card .part-qty { position: absolute; top: 14px; right: 14px; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; background: rgba(8, 17, 26, 0.78); color: #f1f5f9; opacity: 1; }

/* Footer links: a little lower, still clear of the logo badge */
.app-content,
body.assets-view .app-content {
    padding-bottom: 44px;
}

.home-page footer.home-footer { padding-bottom: 56px; }

/* Using a spare part */
.part-use { margin: 12px 0; border: 1px solid #263443; border-radius: 10px; padding: 10px 12px; }
body:not(.dark-mode) .part-use { border-color: #dbe4ee; }
.part-use > summary { cursor: pointer; font-weight: 700; }
.part-use .asset-document-form { margin-top: 12px; }
.use-kind { display: flex; gap: 18px; flex-wrap: wrap; }
.part-qty.part-out { background: rgba(239, 68, 68, 0.85); color: #fff; }
.form-note { margin: 10px 0; padding: 10px 12px; border-radius: 8px; background: rgba(20, 184, 166, 0.18); color: #14b8a6; font-weight: 600; }
.part-uses a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* Pick parts: tick several parts, then act on them together */
.part-check { display: none; position: absolute; top: 14px; left: 14px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #94a3b8; background: rgba(8, 17, 26, 0.7); color: transparent; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; }
.picking .part-check { display: inline-flex; }
.part-card.picked { outline: 3px solid #14b8a6; outline-offset: -1px; }
.part-card.picked .part-check { background: #14b8a6; border-color: #14b8a6; color: #fff; }
.pick-all { flex: none; padding: 2px 10px; border: 1px solid #465669; border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 0.75rem; cursor: pointer; }
.pick-all[hidden] { display: none; }
.pick-bar { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: calc(var(--footer-height, 52px) + env(safe-area-inset-bottom, 0px) + 30px); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: #0f1b28; border: 1px solid #14b8a6; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); color: #f1f5f9; }
body:not(.dark-mode) .pick-bar { background: #fff; color: #1e293b; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25); }
.pick-bar[hidden] { display: none; }
.pick-count { flex: 1 1 auto; font-weight: 700; }
.pick-bar button:disabled { opacity: 0.45; }
.pick-list { display: grid; gap: 8px; }
.pick-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px auto; gap: 8px; align-items: center; }
.pick-row span { overflow-wrap: anywhere; font-weight: 600; }
.pick-row input[type="number"] { width: 100% !important; }
.pick-row small { opacity: 0.7; }
.parts-note { margin-left: clamp(24px, 5vw, 64px); margin-right: clamp(24px, 5vw, 64px); }

/* "How many": minus, the number (type it if you like), plus */
.stepper { display: inline-flex; align-items: stretch; width: 100%; max-width: 190px; }
.stepper input { width: auto !important; min-width: 0; flex: 1 1 auto; text-align: center; border-radius: 0 !important; }
.stepper-btn { flex: none; width: 44px; border: 1px solid #465669; background: rgba(148, 163, 184, 0.15); color: inherit; font: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.stepper-btn:first-child { border-radius: 8px 0 0 8px; border-right: 0; }
.stepper-btn:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.stepper-btn:active { background: rgba(148, 163, 184, 0.3); }
body:not(.dark-mode) .stepper-btn { border-color: #cbd5e1; background: #f1f5f9; }
.pick-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.pick-row .stepper { width: 150px; }
.stepper input { font-size: 1rem !important; font-weight: 600; }

/* Storage place cards flow a few across (two on a phone) instead of one per row */
#parts-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    align-items: start;
}
#parts-groups .parts-group { margin: 0; padding: 10px; border-radius: 12px; min-width: 0; }
#parts-groups .parts-location { flex-wrap: wrap; gap: 4px 6px; margin: 0 0 8px; font-size: 0.95rem; }
#parts-groups .parts-location svg { width: 16px; height: 16px; }
#parts-groups .parts-location-name { flex: 1 1 60px; }
#parts-groups .parts-count { padding: 1px 8px; font-size: 0.7rem; }
#parts-groups .pick-all { padding: 1px 8px; font-size: 0.7rem; }
#parts-groups .parts-list { grid-template-columns: 1fr; gap: 8px; }
#parts-groups .part-card { padding: 6px; gap: 6px; }
#parts-groups .part-card .part-name { font-size: 0.85rem; }
#parts-groups .part-card .part-number { font-size: 0.75rem; }
#parts-groups .part-card .part-qty { top: 10px; right: 10px; font-size: 0.72rem; }
#parts-groups .part-card .part-check { top: 10px; left: 10px; width: 22px; height: 22px; font-size: 0.8rem; }
#parts-groups .part-tag { font-size: 0.68rem; padding: 1px 6px; }
#parts-groups { grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); }

/* Narrow phones: three icons on the left have to fit beside the logo badge without going under it */
@media (max-width: 380px) {
    .header-nav-left { gap: 0; }
    .header-nav-left .header-icon { width: 38px; }
}
@media (max-width: 345px) {
    .header-nav-left .header-icon { width: 35px; }
}

/* Place cards go back to one per row; the parts inside them run across (three on a phone) */
#parts-groups { display: block; }
#parts-groups .parts-group { margin: 14px 0 0; padding: 12px; }
#parts-groups .parts-location { flex-wrap: nowrap; margin: 0 0 10px; font-size: 1.02rem; }
#parts-groups .parts-location-name { flex: 1 1 auto; }
#parts-groups .parts-list { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
#parts-groups .part-card { padding: 5px; gap: 5px; }
#parts-groups .part-card .part-name { font-size: 0.8rem; }
#parts-groups .part-card .part-number { font-size: 0.7rem; }
#parts-groups .part-card .part-qty { top: 8px; right: 8px; font-size: 0.7rem; padding: 0 6px; }
#parts-groups .part-card .part-check { top: 8px; left: 8px; width: 20px; height: 20px; font-size: 0.75rem; }
#parts-groups .part-tag { font-size: 0.65rem; padding: 0 5px; }

/* "How many": one box with the number, and a small minus and plus tucked inside it on the right */
.stepper { position: relative; display: inline-flex; width: 100%; max-width: 150px; }
.stepper input { width: 100% !important; text-align: left; padding-right: 64px !important; border-radius: 8px !important; }
.stepper-btn { position: absolute; top: 50%; width: 26px; height: 26px; margin-top: -13px; padding: 0; border: 0 !important; border-radius: 6px !important; background: rgba(148, 163, 184, 0.22); color: inherit; font-size: 1.05rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.stepper-btn:first-child { right: 34px; left: auto; }
.stepper-btn:last-child { right: 6px; left: auto; }
body:not(.dark-mode) .stepper-btn { background: #e2e8f0; }
.pick-row .stepper { width: 118px; }

/* "How many": the browser's own number box with its up and down arrows, always showing (no custom buttons) */
.stepper, .stepper-btn { all: unset; }
input[type="number"][name="quantity"],
input[type="number"][name="quantities"] { width: 110px; max-width: 100%; }
.pick-row input[type="number"] { width: 100% !important; }
input[type="number"][name="quantity"]::-webkit-inner-spin-button,
input[type="number"][name="quantities"]::-webkit-inner-spin-button { opacity: 1; height: 28px; cursor: pointer; }
.pick-row { grid-template-columns: minmax(0, 1fr) 96px auto; }

/* The page area is pinned between the top of the screen and the bottom bar, so its end always meets the bar's top edge
   (sizing it from viewport units let the footer links slip behind the bar in the installed app). It scrolls inside. */
body .app-content,
body.assets-view .app-content,
body.home-view .app-content {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: calc(var(--footer-height) + env(safe-area-inset-bottom, 0px));
    height: auto;
    min-height: 0;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* A part's condition shows as a small label on its card (nothing is shown for "New"). */
.part-condition { align-self: flex-start; padding: 0 7px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; background: rgba(148, 163, 184, 0.22); color: inherit; }
.part-condition-like-new { background: rgba(20, 184, 166, 0.22); }
.part-condition-used { background: rgba(245, 158, 11, 0.24); }
.part-condition-bad { background: rgba(239, 68, 68, 0.26); }

/* A place that still holds parts can't be removed yet. */
.place-row button[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Each place card has a pencil to edit it, and can be moved up or down from there. */
.place-edit { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 1px solid #465669; border-radius: 8px; background: rgba(148, 163, 184, 0.1); color: #14b8a6; cursor: pointer; }
body:not(.dark-mode) .place-edit { border-color: #cbd5e1; background: #f1f5f9; }
.place-edit:focus-visible { outline: 2px solid var(--primary-color, #2563eb); outline-offset: 1px; }
.parts-location .place-edit svg { width: 16px; height: 16px; color: inherit; }
.place-empty { margin: 0; font-size: 0.85rem; opacity: 0.7; }
.place-move { display: grid; gap: 6px; margin: 16px 0; }
.place-move-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.place-move-buttons form { margin: 0; }
.place-remove-hint { margin: 16px 0 8px; font-size: 0.85rem; opacity: 0.75; }
.place-dialog button[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Editing a place right on its card */
.place-editbar { display: grid; gap: 10px; margin: 0 0 10px; }
.place-editbar[hidden] { display: none; }
.place-editbar .form-error { margin: 0; }
.place-rename-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; margin: 0; }
.place-rename-form input { min-width: 0; padding: 10px 12px; border: 1px solid #465669; border-radius: 8px; background: rgba(10, 18, 27, 0.32); color: inherit; font: inherit; font-weight: 700; }
body:not(.dark-mode) .place-rename-form input { background: #fff; border-color: #cbd5e1; color: #1e293b; }
.place-rename-form .asset-document-submit { width: auto; margin: 0; padding: 10px 14px; }
.place-editbar-row { display: flex; flex-wrap: wrap; gap: 8px; }
.place-editbar-row form { margin: 0; }
.place-editbar button[disabled] { opacity: 0.45; cursor: not-allowed; }
.place-editbar .place-remove-hint { margin: 0; }
.parts-group.editing { border-color: #14b8a6; }
.place-editbar-row .component-remove { width: auto; }

/* Place edit area on a phone: the name gets its own full row, then even buttons below it */
.place-editbar { gap: 10px; padding: 2px 0 4px; }
.place-rename-form { grid-template-columns: 1fr 1fr; gap: 10px; }
.place-rename-form input { grid-column: 1 / -1; width: 100%; box-sizing: border-box; min-height: 48px; font-size: 1.05rem; }
.place-editbar button { width: 100%; min-height: 44px; box-sizing: border-box; margin: 0; padding: 8px 6px; font-size: 0.95rem; line-height: 1.2; }
.place-rename-form .asset-document-submit { width: 100%; padding: 8px 6px; }
.place-editbar-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.place-editbar-row form { display: block; margin: 0; }
.place-editbar-row .component-remove { width: 100%; }
.place-editbar .place-remove-hint { margin: 0; font-size: 0.82rem; line-height: 1.35; }
.place-editbar button { height: 46px; white-space: nowrap; }
.place-editbar-row { grid-template-columns: 1fr 1fr; }
.place-editbar-row form { grid-column: 1 / -1; }

/* Phone: the three buttons above the shelf share one row, and the condition label is a small pill */
.parts-bar { flex-wrap: nowrap; gap: 8px; }
.parts-bar > button { flex: 1 1 0; min-width: 0; justify-content: center; padding-left: 8px; padding-right: 8px; white-space: nowrap; font-size: 0.92rem; }
.parts-bar .asset-gallery-open { flex: 1.3 1 0; gap: 5px; }
.parts-bar .plus-icon { width: 15px; height: 15px; flex: none; }
.part-main .part-condition { display: inline-block; width: fit-content; max-width: 100%; justify-self: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 340px) {
    .parts-bar { flex-wrap: wrap; }
    .parts-bar .asset-gallery-open { flex: 1 1 100%; }
    .parts-bar > button { flex: 1 1 calc(50% - 4px); }
}

/* Blue outline around each storage place card (teal while it is being edited) */
.parts-group { border: 2px solid #3b82f6; }
body:not(.dark-mode) .parts-group { border-color: #2563eb; }
.parts-group.editing, body:not(.dark-mode) .parts-group.editing { border-color: #14b8a6; }
