/* --- GLOBAL CORE STYLES --- */
body {
    font-family: Inter, Arial, sans-serif;
    margin: 0;
    background: #f3f4f6;
    color: #111111;
}

/* Prevent iOS focus-zoom: keep form controls at 16px+ on phones */
@media (max-width: 899px) {
    input,
    textarea,
    select,
    #profile-field-search,
    .subfield-card input,
    .profile-top-edit input[type="text"] {
        font-size: 16px !important;
    }
}

main {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    padding: 0;
}

input {
    display: block;
    margin: 15px auto;
    padding: 10px;
    width: 100%;
    max-width: 260px;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    background: #ffffff;
}

button {
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    transition: box-shadow 0.2s ease, background-color 0.2s ease, filter 0.2s ease;
}

button:hover {
    filter: brightness(0.94);
}

.app-logo-large {
    width: 100px;
    height: auto;
    display: block;
    margin: 0 auto 10px auto;
}

.app-logo-mid {
    width: 56px;
    height: 56px;
    display: block;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.vehicle-card {
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #d9dee7;
    border-radius: 16px;
    padding: 18px;
    width: 100%;
    max-width: 300px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    text-align: left;
}

#dashboard-screen {
    flex-direction: column !important;
    align-items: center;
    width: 100%;
}

#app-shell {
    display: block;
}

#pwa-prompt-screen {
    display: none;
}

body.browser-view #pwa-prompt-screen {
    position: fixed;
    inset: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    box-sizing: border-box;
}

body.browser-view #app-shell {
    display: none !important;
}

body.browser-view {
    height: 100vh;
    overflow: hidden;
}

/* Desktop browser should show normal web app login, not PWA install gate */
@media (min-width: 900px) {
    body.browser-view #pwa-prompt-screen {
        display: none !important;
    }

    body.browser-view #app-shell {
        display: block !important;
    }

    body.browser-view {
        height: auto;
        overflow: auto;
    }
}

#pwa-prompt-screen p {
    color: #111111;
    font-size: 18px;
    max-width: 280px;
}

body:not(.pwa-view) #main-header,
body:not(.pwa-view) #burger-backdrop,
body:not(.pwa-view) .burger-panel,
body:not(.pwa-view) .settings-sheet {
    display: none !important;
}

body:not(.pwa-view) #app-shell {
    display: block;
}

body.pwa-view #pwa-prompt-screen {
    display: none !important;
}

body.pwa-view #app-shell {
    display: block;
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background: #f3f4f6;
}

body.pwa-view #main-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    background: transparent;
}

body.pwa-view main {
    display: block !important;
    padding: 8px 16px 24px;
}

body.pwa-view .screen-card {
    width: 100%;
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
}

body.pwa-view #login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 90px);
    box-sizing: border-box;
    padding: 24px 20px;
}

body.pwa-view #dashboard-screen {
    min-height: calc(100vh - 92px);
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

body.pwa-view #profile-screen {
    position: absolute;
    inset: 0;
    background: #f3f4f6;
    z-index: 2;
    overflow-y: auto;
    padding: 18px 16px 24px;
    max-width: none;
}

body.pwa-view #profile-screen .profile-header-wrapper {
    margin-bottom: 14px;
}

body.pwa-view #profile-screen[data-view="specs"] .profile-header-wrapper,
body.pwa-view #profile-screen[data-view="todo"] .profile-header-wrapper,
body.pwa-view #profile-screen[data-view="maintenance"] .profile-header-wrapper,
body.pwa-view #profile-screen[data-view="maintenance-upcoming"] .profile-header-wrapper,
body.pwa-view #profile-screen[data-view="maintenance-history"] .profile-header-wrapper,
body.pwa-view #profile-screen[data-view="maintenance-intervals"] .profile-header-wrapper,
body.pwa-view #profile-screen[data-view="notes"] .profile-header-wrapper {
    display: none;
}

body.pwa-view .profile-title-block h1 {
    color: #111111;
}

body.pwa-view .profile-title-block p {
    color: #6b7280;
}

body.pwa-view .profile-screen-kicker,
body.pwa-view .pwa-profile-kicker {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 4px;
}

body.pwa-view #profile-top-card,
body.pwa-view .pwa-vehicle-card,
body.pwa-view .pwa-chip,
body.pwa-view .pwa-action-tile,
body.pwa-view .pwa-save-btn,
body.pwa-view .pwa-save-mini-btn,
body.pwa-view .pwa-notes-paper {
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
}

body.pwa-view #profile-top-card {
    min-height: 180px;
    padding: 20px;
    margin: 0 0 14px;
    display: flex;
    align-items: flex-end;
}

body.pwa-view .profile-top-inner {
    width: 100%;
    color: #ffffff;
}

body.pwa-view .profile-top-title {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.05;
}

body.pwa-view .profile-top-status {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 700;
    opacity: 0.92;
}

body.pwa-view .pwa-profile-workspace {
    display: block;
}

body.pwa-view .pwa-profile-panel {
    display: none;
}

body.pwa-view .pwa-profile-panel.is-active {
    display: block;
}

body.pwa-view .pwa-vehicle-card {
    min-height: 200px;
    padding: 18px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: space-between;
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
}

body.pwa-view .pwa-vehicle-card-copy h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.05;
}

body.pwa-view .pwa-vehicle-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
}

body.pwa-view .pwa-vehicle-name-input {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px 12px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: #111111;
    font-size: 18px;
    font-weight: 700;
}

body.pwa-view #pwa-card-edit-btn {
    display: none;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: #111111;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    cursor: pointer;
}

body.pwa-view .pwa-vehicle-card-copy p {
    margin: 6px 0 0;
    opacity: 0.92;
}

body.pwa-view #pwa-vehicle-status-text {
    margin-top: 8px;
    font-weight: 700;
}

body.pwa-view .pwa-chip-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 14px;
}

body.pwa-view .pwa-chip {
    background: rgba(255, 255, 255, 0.94);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #111111;
}

body.pwa-view .pwa-chip span {
    font-size: 12px;
    font-weight: 800;
    color: #6b7280;
}

body.pwa-view .pwa-chip select,
body.pwa-view .pwa-chip input {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111111;
}

body.pwa-view .pwa-action-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

body.pwa-view .pwa-action-tile {
    min-height: 74px;
    background: #ffffff;
    border-left: 5px solid #ffae00;
    border-radius: 12px;
    color: #111111;
    font-size: 16px;
    font-weight: 700;
    text-align: left;
    padding: 0 16px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

body.pwa-view .pwa-save-btn,
body.pwa-view .pwa-save-mini-btn {
    width: 100%;
    min-height: 52px;
    background: #01acfe;
    color: #ffffff;
    font-weight: 800;
}

body.pwa-view .pwa-panel-header .pwa-save-mini-btn {
    width: 42px;
    min-height: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex: 0 0 42px;
}

body.pwa-view .pwa-icon-btn {
    color: #ffffff;
}

body.pwa-view .pwa-icon-pencil {
    width: 18px;
    height: 18px;
    display: block;
}

body.pwa-view .pwa-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    margin-bottom: 14px;
}

body.pwa-view .pwa-specs-search-block {
    flex: 1;
}

body.pwa-view .pwa-panel-header-spacer {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
}

body.pwa-view #pwa-todo-view .pwa-specs-search-block h2 {
    margin: 0;
    font-size: 18px;
    color: #111111;
}

body.pwa-view .pwa-specs-search-block #profile-field-search {
    margin: 0;
}

body.pwa-view .pwa-back-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    font-weight: 800;
}

body.pwa-view .pwa-specs-fields {
    margin-top: 6px;
    padding-bottom: 24px;
}

body.pwa-view #pwa-subfields-container,
body.pwa-view #pwa-todo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin: 0 auto;
}

body.pwa-view #pwa-maintenance-upcoming-container,
body.pwa-view #pwa-maintenance-history-container,
body.pwa-view #pwa-maintenance-intervals-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    margin: 0 auto;
}

body.pwa-view .pwa-notes-paper {
    width: 100%;
    min-height: 58vh;
    padding: 18px;
    box-sizing: border-box;
    resize: none;
    background:
        linear-gradient(#ffffff, #ffffff) padding-box,
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 27px,
            rgba(59,130,246,.12) 28px
        );
}

body.pwa-view #subfields-container {
    display: none;
}

body.pwa-view .profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

body.pwa-view .profile-actions button {
    width: 100%;
}

body.pwa-view .settings-sheet .sheet-title {
    font-size: 18px;
}

body.pwa-view .icon-bubble {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ffffff;
    color: #111111;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
    padding: 0;
}

body.pwa-view .icon-bubble .burger-line {
    display: block;
    width: 16px;
    height: 2px;
    background: currentColor;
    margin: 0 0 4px;
    border-radius: 999px;
}

body.pwa-view .icon-bubble .burger-line:last-child {
    margin-bottom: 0;
}

body.pwa-view .icon-bubble svg {
    width: 20px;
    height: 20px;
}

body.pwa-view .topbar-logo {
    display: flex;
    justify-content: center;
    flex: 1;
}

body.pwa-view .burger-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.24);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 8;
}

body.pwa-view .burger-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

body.pwa-view .burger-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 76%;
    max-width: 320px;
    background: #ffffff;
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.16);
    transform: translateX(-102%);
    transition: transform 0.25s ease;
    z-index: 9;
    display: flex;
    flex-direction: column;
    padding: 22px 18px 18px;
    box-sizing: border-box;
    visibility: hidden;
}

body.pwa-view .burger-panel.is-open {
    transform: translateX(0);
    visibility: visible;
}

body.pwa-view .settings-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    background: #ffffff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.16);
    transform: translateY(110%);
    transition: transform 260ms cubic-bezier(.2,.9,.2,1), opacity 200ms ease;
    z-index: 1000;
    padding: 18px 16px 20px;
    box-sizing: border-box;
    max-height: 78vh;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
}

/* When opened in PWA, expand the sheet to cover the entire app (header + dashboard)
   and prevent interactions with the background. */
body.pwa-view .settings-sheet.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
    top: 0;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    overflow-y: auto;
}

/* When settings are open, make the rest of the app inert */
body.settings-open #app-shell > main,
body.settings-open #main-header,
body.settings-open .burger-panel {
    pointer-events: none !important;
    user-select: none !important;
    opacity: 1;
}

/* Position the Done button over the top area (over the header icons) when sheet is open */
body.pwa-view .settings-done-btn {
    position: relative;
}

body.pwa-view .settings-sheet.is-open .settings-done-btn {
    position: fixed;
    top: 12px;
    right: 16px;
    z-index: 1100;
    background: rgb(1,172,254);
    color: #ffffff;
    font-weight: 700;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(2,6,23,0.12);
    font-size: 15px;
}

/* --- 2. INSTALLED MOBILE PWA VIEW --- */
@media (max-width: 899px) and (display-mode: standalone) {
    #pwa-prompt-screen {
        display: none !important;
    }

/* --- PWA profile inflated view --- */
body.pwa-view.profile-open #main-header,
body.pwa-view.profile-open #burger,
body.pwa-view.profile-open #burger-backdrop {
    display: none !important;
}

/* Back bubble positioned where the burger sits */
#profile-back-btn {
    background: rgb(1,172,254);
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(2,6,23,0.12);
    border: none;
    font-weight: 700;
}

/* Top card layout inside profile-screen */
.profile-top-card {
    width: 100%;
    max-width: 320px;
    --profile-top-height: 220px;
    height: var(--profile-top-height);
    border-radius: 24px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #111111;
    box-shadow: 0 14px 40px rgba(2,6,23,0.18);
    margin: 0 auto 18px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.profile-top-card.is-editing {
    cursor: default;
    justify-content: flex-start;
    height: auto;
    min-height: 340px;
    transition: min-height 160ms ease;
}

.profile-top-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 46px rgba(2,6,23,0.22);
}

.profile-top-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.profile-top-header {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.profile-top-edit-btn {
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: #111111;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 10px;
    cursor: pointer;
}

.profile-top-inner .profile-top-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0;
    text-align: center;
}

.profile-top-inner .profile-top-status {
    font-size: 16px;
    font-weight: 600;
    opacity: 1;
}

.profile-top-edit {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    height: auto;
}

.profile-top-edit label {
    color: #111111;
    font-size: 12px;
    font-weight: 700;
}

.profile-top-edit input[type="text"] {
    width: 100%;
    max-width: none;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(17,17,17,0.25);
    background: rgba(255,255,255,0.92);
    color: #111111;
    margin: 0 0 8px 0;
    box-sizing: border-box;
}

.profile-top-edit button {
    background: #ffffff;
    color: #111111;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    margin-right: 10px;
    font-weight: 700;
}

.profile-top-edit button:last-child {
    margin-right: 0;
}

.profile-top-edit input[type="color"] {
    height: 40px;
    width: 72px;
    max-width: none;
    padding: 4px;
    margin: 0 0 8px 0;
    border: 1px solid rgba(17,17,17,0.25);
    border-radius: 10px;
}

/* Subfield cards half the top card height */
.subfield-card {
    min-height: calc(var(--profile-top-height) / 2);
    padding: 12px;
    box-sizing: border-box;
}

/* Clone used for inflate animation */
.inflate-clone { overflow: hidden; }

    body {
        background: #f3f4f6;
    }

    #add-vehicle-btn,
    .add-vehicle-wrapper {
        display: none !important;
    }

    #app-shell {
        position: relative;
        min-height: 100vh;
        overflow: hidden;
        background: #f3f4f6;
        display: block;
    }

    #main-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px 10px;
        background: transparent;
    }

    main {
        display: block !important;
        padding: 8px 16px 24px;
    }

    .screen-card {
        width: 100%;
        background: #ffffff;
        border-radius: 24px;
        border: 1px solid #e5e7eb;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
        box-sizing: border-box;
    }

    #login-screen {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: calc(100vh - 90px);
        box-sizing: border-box;
        padding: 24px 20px;
    }

    .login-branding-block {
        text-align: center;
        margin-bottom: 20px;
    }

    .login-brand-title {
        display: block;
        color: #111111;
        font-size: 28px;
        margin: 8px 0 0;
    }

    .login-details-block {
        width: 100%;
        text-align: center;
    }

    .login-details-block button {
        width: 100%;
        max-width: 260px;
        padding: 12px 16px;
        background: rgb(1,172,254);
        color: #fff;
        font-weight: 600;
    }

    #dashboard-screen {
        min-height: calc(100vh - 92px);
        padding: 16px;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        margin-top: 0;
    }

    #vehicles-container {
        display: flex;
        flex-direction: column;
        gap: 14px;
        width: 100%;
    }

    .add-vehicle-wrapper {
        margin-top: 12px;
    }

    #add-vehicle-btn {
        width: 100%;
        background: rgb(1,172,254);
        color: #fff;
        padding: 12px 16px;
        font-weight: 600;
    }

    .icon-bubble {
        width: 42px;
        height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: #ffffff;
        color: #111111;
        box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
        padding: 0;
    }

    .icon-bubble span {
        display: block;
        width: 16px;
        height: 2px;
        background: currentColor;
        margin: 2px 0;
        border-radius: 999px;
    }

    .icon-bubble svg {
        width: 20px;
        height: 20px;
    }

    .topbar-logo {
        display: flex;
        justify-content: center;
        flex: 1;
    }

    /* profile slide transition */
    body.pwa-view #profile-screen {
        transform: translate3d(100%, 0, 0);
        opacity: 0;
        transition: transform 120ms ease-out, opacity 120ms ease-out;
        will-change: transform, opacity;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #f3f4f6;
        z-index: 2;
        padding: 20px;
        overflow-y: auto;
    }

    body.pwa-view #profile-screen.active {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }

    body.pwa-view #profile-screen .profile-title-block {
        display: none;
    }

    body.pwa-view #dashboard-screen {
        position: relative;
        z-index: 1;
    }

    body.pwa-view.profile-open #dashboard-screen {
        transform: translate3d(-10%, 0, 0);
        opacity: 0.8;
        transition: transform 120ms ease-out, opacity 120ms ease-out;
        will-change: transform, opacity;
    }

    .burger-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(17, 24, 39, 0.24);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
        z-index: 8;
    }

    .burger-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .burger-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 76%;
        max-width: 320px;
        background: #ffffff;
        box-shadow: 12px 0 32px rgba(15, 23, 42, 0.16);
        transform: translateX(-102%);
        transition: transform 0.25s ease;
        z-index: 9;
        display: flex;
        flex-direction: column;
        padding: 22px 18px 18px;
        box-sizing: border-box;
        visibility: hidden;
    }

    .burger-panel.is-open {
        visibility: visible;
    }

    .burger-panel.is-open {
        transform: translateX(0);
    }

    .burger-top {
        display: flex;
        align-items: center;
        gap: 12px;
        padding-bottom: 16px;
        border-bottom: 1px solid #e5e7eb;
    }

    .burger-avatar {
        width: 46px;
        height: 46px;
        border-radius: 50%;
        background: #e0f2fe;
        color: #0369a1;
        display: grid;
        place-items: center;
        font-weight: 700;
    }

    .burger-user-meta p {
        margin: 0 0 2px;
        font-size: 12px;
        color: #6b7280;
    }

    .burger-user-meta strong {
        font-size: 15px;
        color: #111111;
    }

    .burger-spacer {
        flex: 1;
    }

    .burger-logout {
        width: 100%;
        padding: 12px 14px;
        background: #f3f4f6;
        color: #4b5563;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .burger-version {
        margin-top: 12px;
        color: #9ca3af;
        font-size: 12px;
        text-align: center;
    }

    .settings-sheet {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        background: #ffffff;
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.16);
        transform: translateY(110%);
        transition: transform 0.25s ease;
        z-index: 10;
        padding: 18px 16px 20px;
        box-sizing: border-box;
        max-height: 78vh;
        overflow-y: auto;
        visibility: hidden;
    }

    .settings-sheet.is-open {
        transform: translateY(0);
        visibility: visible;
    }

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

    .sheet-title {
        font-size: 18px;
        font-weight: 700;
        color: #111111;
    }

    .settings-done-btn {
        background: rgb(1,172,254);
        color: #ffffff;
        padding: 8px 14px;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        font-size: 15px;
    }

    .settings-vehicles-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 14px;
    }

    .settings-vehicle-row {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
        padding: 12px 12px;
        background: #f9fafb;
        border: 1px solid #e5e7eb;
        border-radius: 14px;
    }

    .settings-name-input {
        flex: 1;
        width: 100%;
        max-width: none;
        margin: 0;
        height: 42px;
        box-sizing: border-box;
        border: 1px solid #d0d7de;
        border-radius: 10px;
        background: #ffffff;
        color: #111111;
        padding: 10px 12px;
    }

    .settings-row-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .settings-rename-btn {
        height: 42px;
        padding: 0 12px;
        border-radius: 10px;
        background: rgb(1,172,254);
        color: #ffffff;
        font-weight: 700;
        min-width: 64px;
    }

    .settings-rename-btn:disabled {
        opacity: 0.7;
        cursor: default;
    }

    .settings-vehicle-row.is-dirty .settings-name-input {
        border-color: #38bdf8;
        box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
    }

    .settings-delete-btn {
        width: 42px;
        height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        background: #ef4444;
        color: #fff;
        padding: 0;
        font-size: 18px;
    }

    .settings-add-btn {
        width: 100%;
        padding: 14px 18px;
        background: rgb(1,172,254);
        color: #fff;
        font-weight: 700;
        font-size: 16px;
    }

    body.authenticated #login-screen {
        display: none !important;
    }
}

/* --- 3. DESKTOP COMPUTER VIEW --- */
@media (min-width: 900px) {
    #pwa-prompt-screen {
        display: none !important;
    }

    #app-shell {
        min-height: 100vh;
        background: #f3f4f6;
        display: flex;
        flex-direction: column;
    }

    #main-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 18px 24px;
        max-width: 960px;
        margin: 0 auto;
    }

    main {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 24px;
        max-width: 1320px;
        width: 100%;
        margin: 0 auto;
        padding: 8px 24px 24px;
        box-sizing: border-box;
        flex: 1 1 auto;
    }

    .screen-card {
        background: #ffffff;
        border-radius: 24px;
        border: 1px solid #e5e7eb;
        box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    }

    #login-screen {
        display: flex;
        flex-direction: row-reverse;
        align-items: stretch;
        justify-content: space-between;
        min-height: calc(100vh - 96px);
        width: min(100%, 1280px);
        max-width: 1280px;
        margin: 0 auto;
        gap: 22px;
        padding: 26px;
        box-sizing: border-box;
        flex-wrap: nowrap;
    }

    .login-details-block {
        flex: 1 1 340px;
        min-width: 320px;
        max-width: 420px;
        text-align: left;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 30px;
        border-radius: 20px;
        background: #ffffff;
        border: 1px solid #e5e7eb;
        box-sizing: border-box;
    }

    .login-details-block h2 {
        margin: 0 0 10px;
        font-size: 30px;
    }
    
    .login-details-block input {
        margin: 12px 0;
        max-width: none;
        height: 44px;
        box-sizing: border-box;
    }

    .login-details-block button {
        width: 100%;
        max-width: none;
        margin: 12px 0;
        padding: 10px;
        border: 1px solid #d0d7de;
        border-radius: 10px;
        height: 44px;
        box-sizing: border-box;
        background: #3498db;
        color: #fff;
        line-height: 1;
    }

    .login-branding-block {
        flex: 1.35 1 480px;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: linear-gradient(155deg, #ffffff 0%, #eef6ff 100%);
        padding: 60px;
        border-radius: 28px;
        border: 1px solid #e5e7eb;
        box-sizing: border-box;
        overflow: hidden;
    }

    .login-branding-block .app-logo-large {
        width: min(42vw, 360px);
        max-width: 360px;
        border-radius: 32px;
        padding: 14px;
        background: #ffffff;
        box-shadow: 0 16px 44px rgba(15, 23, 42, 0.18);
        margin-bottom: 28px;
    }

    .login-brand-title {
        display: block;
        color: #111111;
        font-size: clamp(42px, 4.8vw, 72px);
        margin: 0;
        line-height: 1.02;
        text-align: center;
    }

    .vehicle-card {
        max-width: 350px;
    }

    body.authenticated #login-screen {
        display: none !important;
    }
}

@media (min-width: 900px) and (max-width: 1279px) {
    #main-header {
        max-width: 1120px;
        padding: 16px 20px;
    }

    main {
        max-width: 1120px;
        padding: 8px 20px 20px;
    }

    #login-screen {
        gap: 18px;
        padding: 20px;
    }

    .login-branding-block {
        padding: 36px;
    }

    .login-branding-block .app-logo-large {
        width: min(36vw, 280px);
        margin-bottom: 20px;
    }

    .login-brand-title {
        font-size: clamp(34px, 4vw, 54px);
    }
}

@media (min-width: 900px) and (max-height: 759px) {
    #main-header {
        padding: 12px 20px;
    }

    main {
        align-items: flex-start;
        padding: 4px 20px 20px;
    }

    #login-screen {
        min-height: auto;
        gap: 16px;
        padding: 18px;
    }

    .login-details-block,
    .login-branding-block {
        padding: 24px;
    }

    .login-branding-block .app-logo-large {
        width: min(24vw, 200px);
        margin-bottom: 16px;
    }

    .login-brand-title {
        font-size: clamp(28px, 3.2vw, 44px);
    }

    .login-details-block h2 {
        font-size: 26px;
        margin-bottom: 8px;
    }

    .login-details-block input {
        margin: 10px 0;
    }
}

/* --- UNIVERSAL CREATION CALLOUT CONTAINER BAR --- */
.add-vehicle-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 20px 0 40px 0;
    padding: 0 20px;
    box-sizing: border-box;
}

#add-vehicle-btn {
    width: 100%;
    max-width: 300px;
    background-color: #2ecc71;
    padding: 14px;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#add-vehicle-btn:hover {
    background-color: #27ae60;
}

@media (min-width: 900px) {
    #add-vehicle-btn {
        max-width: 350px;
    }
}

/* --- VEHICLE PROFILE STRUCTURAL LAYOUT COMPONENT --- */
#profile-screen {
    --profile-card-max-width: 320px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    color: #ffffff;
    position: relative;
    background: transparent;
}

.profile-header-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 16px;
    width: 100%;
}

.profile-search-block {
    flex: 1;
    max-width: none;
}

.profile-header-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    flex: 1;
}

.profile-header-logo .app-logo-mid {
    width: 44px;
    height: 44px;
}

.profile-header-spacer {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
}

#profile-field-search {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid #c7d2fe;
    background: #ffffff;
    color: #111111;
    box-sizing: border-box;
}

#profile-back-btn {
    background: #ffffff;
    color: #111111;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    border: none;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.profile-title-block {
    text-align: center;
}

.profile-title-block h1 {
    color: #ffffff;
    margin: 0 0 8px 0;
    font-size: 28px;
}

.profile-title-block p {
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.profile-title-block {
    text-align: center;
    flex: 1;
}

.profile-title-block-hidden {
    display: none;
}

.profile-title-block h1 {
    color: #ffae00;
    margin: 0 0 5px 0;
    font-size: 28px;
}

.profile-title-block p {
    color: #ffffff;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#profile-edit-toggle {
    background: transparent;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #111111;
    margin-left: auto;
}

#profile-edit-toggle:hover {
    opacity: 0.8;
}

.edit-icon-btn {
    width: 28px;
    height: 28px;
    display: block;
}

.profile-top-card {
    width: 100%;
    max-width: var(--profile-card-max-width);
    margin: 0 auto 18px;
    box-sizing: border-box;
}

/* Custom Subfields Grid Cards layout blocks */
#subfields-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
    width: 100%;
}

#pwa-subfields-container .subfield-card {
    margin: 0;
}

#pwa-todo-container .subfield-card {
    margin: 0;
}

#pwa-maintenance-upcoming-container .subfield-card,
#pwa-maintenance-history-container .subfield-card,
#pwa-maintenance-intervals-container .subfield-card {
    margin: 0;
}

.maintenance-dropdown {
    margin-top: 6px;
    border: 1px solid #dbe3f5;
    border-radius: 10px;
    padding: 8px;
    background: #f8fbff;
}

.maintenance-dropdown summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: #1f2937;
}

.maintenance-type-search {
    margin: 8px 0;
    width: 100%;
    max-width: none;
}

.maintenance-type-options {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 6px;
    background: #ffffff;
}

.maintenance-type-option {
    margin: 0;
    display: block;
    font-size: 13px;
    color: #111827;
}

.maintenance-type-option input {
    margin-right: 8px;
}

.subfield-card {
    background-color: #ffffff;
    color: #000000;
    border-left: 5px solid #ffae00;
    border-radius: 6px;
    padding: 15px;
    width: 100%;
    max-width: var(--profile-card-max-width);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-align: left;
    box-sizing: border-box;
}

.subfield-card h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #191A1B;
}

.subfield-card p {
    margin: 4px 0;
    font-size: 14px;
}

.subfield-card label {
    font-size: 11px;
    font-weight: bold;
    display: block;
    color: #555;
    margin-top: 8px;
    text-align: left;
}

.subfield-card input {
    width: 100%;
    max-width: 100%;
    margin: 4px 0;
    padding: 6px;
    font-size: 13px;
    box-sizing: border-box;
}

.subfield-delete-btn {
    background-color: #e74c3c;
    color: #ffffff;
    padding: 12px 12px;
    min-height: 48px;
    font-size: 14px;
    font-weight: 700;
    margin-top: 10px;
    width: 100%;
}

.todo-remove-btn {
    width: auto;
    min-height: 34px;
    padding: 8px 12px;
    font-size: 12px;
    margin-top: 8px;
}

/* Control settings actions block wrapper footer */
#profile-edit-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    margin-top: 20px;
    width: 100%;
}

    #pwa-specs-edit-actions,
    #pwa-todo-edit-actions,
    #pwa-maintenance-history-edit-actions,
    #pwa-maintenance-intervals-edit-actions {
        display: flex;
        justify-content: center;
        margin-top: 16px;
    }

    #pwa-specs-add-field-btn,
    #pwa-todo-add-btn,
    #pwa-maintenance-history-add-btn,
    #pwa-maintenance-intervals-add-btn {
        width: 100%;
        min-height: 52px;
        background: #3498db;
        color: #ffffff;
        font-size: 15px;
        font-weight: 700;
    }

#profile-add-field-btn { background-color: #3498db; color: #ffffff; width: 100%; max-width: 300px; min-height: 52px; font-size: 15px; font-weight: 700; }
#profile-save-btn { background-color: #2ecc71; color: #ffffff; width: 100%; max-width: 300px; min-height: 52px; font-size: 15px; font-weight: 700; }
#profile-delete-btn { background-color: #e74c3c; width: 100%; max-width: 300px; margin-top: 20px; }