:root {
    color-scheme: light;
    --ink: #14171f;
    --muted: #6c7280;
    --panel: #ffffff;
    --line: #e3e7ee;
    --field: #f5f7fa;
    --bg: #eef2f7;
    --green: #111827;
    --green-2: #2563eb;
    --blue: #2563eb;
    --rust: #d65336;
    --amber: #dba744;
    --ok: #2f7a58;
    --danger: #aa3d36;
    --soft-green: #eaf7ef;
    --soft-blue: #eaf2ff;
    --soft-rust: #fff0ea;
    --purple: #7c3aed;
    --shadow: 0 18px 50px rgba(15, 23, 42, .12);
    --shadow-soft: 0 10px 26px rgba(15, 23, 42, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,255,255,0) 320px),
        var(--bg);
    color: var(--ink);
    font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .48;
}

.app-shell {
    min-height: 100vh;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(280px, 440px) 1fr;
    min-height: 100vh;
}

.auth-panel {
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 22px;
}

.auth-visual {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(120deg, rgba(35, 54, 47, .9), rgba(56, 93, 116, .72)),
        url("data:image/svg+xml,%3Csvg width='1200' height='900' viewBox='0 0 1200 900' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1200' height='900' fill='%23e9e3d8'/%3E%3Cg fill='none' stroke='%2323362f' stroke-width='20' stroke-linecap='round' stroke-linejoin='round' opacity='.23'%3E%3Cpath d='M198 574h792l-76-184c-21-49-57-72-111-72H400c-51 0-87 22-111 67l-91 189z'/%3E%3Ccircle cx='350' cy='609' r='78'/%3E%3Ccircle cx='850' cy='609' r='78'/%3E%3Cpath d='M377 414h441M488 319l-71 96M704 318l67 97'/%3E%3C/g%3E%3C/svg%3E") center/cover;
}

.auth-copy {
    position: absolute;
    left: clamp(32px, 8vw, 110px);
    right: clamp(32px, 8vw, 110px);
    bottom: clamp(36px, 8vw, 96px);
    color: #fff;
}

.auth-copy h1 {
    margin: 0;
    font-size: clamp(42px, 8vw, 88px);
    line-height: .95;
}

.auth-copy p {
    max-width: 640px;
    margin: 22px 0 0;
    font-size: 20px;
    color: rgba(255, 255, 255, .82);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 18px;
    color: var(--green);
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--green);
    color: white;
    display: grid;
    place-items: center;
}

.boot-layout {
    display: grid;
    place-items: center;
}

.boot-card {
    display: grid;
    justify-items: center;
    gap: 18px;
}

.topbar,
.sidebar,
.panel {
    background: var(--panel);
}

.dashboard {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 304px 1fr;
}

.sidebar {
    border-right: 1px solid rgba(221, 216, 206, .8);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(18px);
}

.workspace {
    min-width: 0;
    display: grid;
    grid-template-rows: auto 1fr;
    background: transparent;
}

.topbar {
    min-height: 74px;
    border-bottom: 1px solid rgba(221, 216, 206, .85);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.content {
    padding: 24px;
    display: grid;
    gap: 18px;
    align-content: start;
}

.split {
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
    gap: 18px;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.panel-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-header h2,
.panel-header h3 {
    margin: 0;
    font-size: 17px;
}

.panel-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.panel-body {
    padding: 18px;
}

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

.field {
    display: grid;
    gap: 6px;
}

.field.full {
    grid-column: 1 / -1;
}

.field-help {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--field);
    color: var(--ink);
    padding: 10px 12px;
    outline: none;
}

input:not([type="file"]):not([type="checkbox"]):not([type="radio"]),
select {
    height: 44px;
    line-height: 20px;
}

textarea {
    min-height: 84px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green-2);
    box-shadow: 0 0 0 3px rgba(63, 102, 85, .14);
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: #ebe7df;
    border-radius: 8px;
}

.segmented button {
    min-height: 36px;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
}

.segmented button.active {
    background: #fff;
    color: var(--green);
    box-shadow: 0 4px 12px rgba(32, 38, 31, .08);
}

.segmented.compact {
    display: flex;
    width: max-content;
}

.segmented.compact button {
    min-height: 34px;
    padding: 0 12px;
    white-space: nowrap;
}

.btn {
    min-height: 40px;
    border-radius: 6px;
    padding: 0 14px;
    background: var(--green);
    color: #fff;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
}

.btn.secondary {
    background: #e7e3d9;
    color: var(--ink);
}

.btn.blue {
    background: var(--blue);
}

.btn.rust {
    background: var(--rust);
}

.btn.danger {
    background: var(--danger);
}

.btn.ghost {
    background: transparent;
    color: var(--green);
    border: 1px solid var(--line);
}

.tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #ece7dc;
    border-radius: 8px;
    padding: 4px;
}

.tab {
    min-height: 38px;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-weight: 800;
}

.tab.active {
    background: white;
    color: var(--green);
    box-shadow: 0 4px 14px rgba(34, 40, 32, .08);
}

.vehicle-list {
    display: grid;
    gap: 10px;
    overflow: auto;
}

/* Own vehicles first, then a section per owner who shared one. Without this
   a shared vehicle sat in the list as if it were yours. */
.vehicle-group {
    display: grid;
    gap: 10px;
}

.vehicle-group + .vehicle-group {
    margin-top: 14px;
}

.vehicle-group-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    padding: 0 2px;
}

.vehicle-group-title {
    font-size: 12px;
    font-weight: 900;
}

/* Only the eyebrow is shouted. The title next to it is an owner's name, and
   uppercasing a name throws away how that person spells it. */
.vehicle-group-meta {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.vehicle-item {
    text-align: left;
    border-radius: 8px;
    padding: 14px;
    background: rgba(249, 247, 242, .86);
    color: var(--ink);
    border: 1px solid transparent;
    box-shadow: 0 1px 0 rgba(34, 40, 32, .04);
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.vehicle-item.active {
    border-color: var(--green-2);
    background: #eef3ee;
}

.vehicle-item:hover {
    transform: translateY(-1px);
    border-color: #cfc8ba;
}

.vehicle-item strong {
    display: block;
}

.vehicle-item .vehicle-list-title {
    line-height: 1.35;
}

.vehicle-title-dot {
    opacity: .42;
}

.vehicle-item > span,
.meta {
    color: var(--muted);
    font-size: 13px;
}

.metric-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.detail-header {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow-soft);
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.detail-header h1 {
    margin: 2px 0 4px;
    font-size: 30px;
    line-height: 1.1;
}

.eyebrow {
    color: var(--green-2);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.compact-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.subnav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(221, 216, 206, .85);
    padding: 0 2px 0;
}

.subnav button {
    min-height: 42px;
    padding: 0 12px;
    background: transparent;
    color: var(--muted);
    font-weight: 900;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}

.subnav button.active {
    color: var(--green);
    border-bottom-color: var(--green-2);
}

.single-column {
    max-width: 860px;
    display: grid;
    gap: 18px;
}

.welcome-panel {
    min-height: 360px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(238, 244, 239, .96), rgba(255, 255, 255, .92)),
        radial-gradient(circle at right top, rgba(56, 93, 116, .16), transparent 36%);
    box-shadow: var(--shadow-soft);
    padding: 48px;
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 18px;
}

.welcome-panel h1 {
    max-width: 760px;
    margin: 6px 0 10px;
    font-size: 48px;
    line-height: 1;
}

.welcome-panel p {
    max-width: 640px;
    margin: 0;
    color: var(--muted);
    font-size: 18px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.info-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfaf7;
}

.info-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.info-item strong {
    display: block;
    margin-top: 3px;
}

.notes-block {
    border-top: 1px solid var(--line);
    padding-top: 14px;
}

.notes-block p {
    margin: 4px 0 0;
    white-space: pre-line;
}

.toolbar-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: #fbfaf7;
}

.danger-zone {
    border-color: #e1c3bd;
}

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

.list-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fbfaf7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.list-card strong {
    display: block;
}

.chip-row {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.chip {
    min-height: 28px;
    border-radius: 999px;
    padding: 5px 9px;
    background: var(--soft-blue);
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.chip.strong {
    background: var(--soft-green);
    color: var(--green);
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    justify-content: flex-end;
    background: rgba(27, 32, 28, .28);
    backdrop-filter: blur(4px);
}

.drawer {
    width: min(560px, 100vw);
    height: 100%;
    background: var(--panel);
    box-shadow: -24px 0 54px rgba(31, 42, 34, .2);
    display: grid;
    grid-template-rows: auto 1fr;
}

.drawer-header {
    min-height: 82px;
    border-bottom: 1px solid var(--line);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.drawer-header h2 {
    margin: 2px 0 0;
    font-size: 22px;
}

.drawer-body {
    padding: 20px;
    overflow: auto;
}

.drawer .panel {
    border: 0;
    box-shadow: none;
}

.drawer .panel-header {
    display: none;
}

.drawer .panel-body {
    padding: 0;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #eee9df;
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    display: grid;
    place-items: center;
}

.search-field {
    position: relative;
    display: grid;
    gap: 6px;
    min-width: min(420px, 100%);
}

.search-field span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.search-field input {
    border-radius: 8px;
    background: #f8fafc;
}

.top-search {
    display: block;
    flex: 1;
    max-width: 520px;
}

.top-search input {
    width: 100%;
}

.vehicle-stage {
    position: relative;
    min-height: 390px;
    border-radius: 8px;
    overflow: hidden;
    padding: 28px;
    display: grid;
    grid-template-columns: minmax(220px, .9fr) minmax(360px, 1.45fr) minmax(220px, .8fr);
    align-items: center;
    gap: 22px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(17, 24, 39, .98), rgba(30, 41, 59, .96)),
        radial-gradient(circle at 72% 18%, rgba(37, 99, 235, .28), transparent 32%);
    box-shadow: var(--shadow);
}

.vehicle-stage::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 45%;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .22));
    pointer-events: none;
}

.vehicle-identity,
.vehicle-photo-frame,
.hero-metrics {
    position: relative;
    z-index: 1;
}

.vehicle-identity h1 {
    margin: 8px 0 8px;
    font-size: 46px;
    line-height: .96;
}

.vehicle-identity h1 span {
    display: block;
    color: rgba(255, 255, 255, .72);
    font-weight: 600;
}

.vehicle-identity h1 .vehicle-brand,
.vehicle-identity h1 .vehicle-model {
    display: block;
}

.vehicle-stage .meta {
    color: rgba(255, 255, 255, .72);
}

.hero-actions {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vehicle-photo-frame {
    height: 300px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    padding: 10px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02)),
        rgba(15, 23, 42, .48);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), 0 24px 60px rgba(0, 0, 0, .24);
}

.vehicle-photo-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 6px;
}

.vehicle-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, .18), rgba(124, 58, 237, .14)),
        rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .78);
}

.vehicle-placeholder span {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #111827;
    background: #fff;
    font-size: 32px;
    font-weight: 900;
}

.hero-metrics {
    display: grid;
    gap: 10px;
}

.hero-metrics .metric {
    background: rgba(255, 255, 255, .92);
    border-color: rgba(255, 255, 255, .3);
}

.hero-metrics .metric.dark {
    color: #fff;
    background: rgba(37, 99, 235, .9);
}

.hero-metrics .metric.dark .meta {
    color: rgba(255, 255, 255, .75);
}

.overview-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr);
    gap: 18px;
}

.timeline-list,
.fuel-list {
    display: grid;
    gap: 10px;
}

.timeline-item,
.fuel-card,
.record-card,
.asset-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 14px;
}

.timeline-item,
.fuel-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.timeline-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

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

.expense-list {
    display: grid;
    gap: 8px;
}

.expense-toolbar {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.expense-totals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.expense-totals span {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fbfcfe;
    color: var(--muted);
    font-size: 12px;
}

.expense-totals b {
    display: block;
    color: var(--ink);
    font-size: 17px;
}

.expense-toolbar-actions {
    display: flex;
    justify-content: flex-end;
}

.filter-toggle {
    gap: 7px;
}

.filter-icon {
    width: 14px;
    height: 12px;
    display: inline-block;
    position: relative;
}

.filter-icon::before,
.filter-icon::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.filter-icon::before {
    top: 2px;
    box-shadow: 4px 4px 0 currentColor;
}

.filter-icon::after {
    top: 10px;
    width: 8px;
}

.expense-filter-grid {
    display: grid;
    grid-template-columns: minmax(160px, 1.2fr) minmax(140px, .8fr) minmax(140px, .8fr) auto;
    gap: 8px;
    align-items: end;
}

.filter-field {
    display: grid;
    gap: 5px;
}

.filter-field span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.expense-row {
    display: grid;
    grid-template-columns: minmax(92px, .32fr) minmax(0, 1fr) minmax(170px, auto);
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fbfcfe;
    cursor: pointer;
    transition: border-color .16s ease, transform .16s ease;
}

.expense-row:hover {
    border-color: rgba(37, 99, 235, .32);
    transform: translateY(-1px);
}

.expense-date,
.expense-main,
.expense-actions {
    display: grid;
    gap: 6px;
}

.expense-date span {
    color: var(--muted);
    font-size: 12px;
}

.expense-date .expense-category {
    justify-self: start;
    max-width: 92px;
    min-height: 24px;
    padding: 3px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.expense-main {
    min-width: 0;
}

.expense-main strong,
.expense-main .meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.expense-note {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-line;
}

.expense-actions {
    justify-items: end;
}

.compact-row {
    justify-content: flex-end;
    gap: 6px;
}

.expense-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 22px;
    background: rgba(17, 24, 39, .54);
    backdrop-filter: blur(6px);
}

.expense-modal {
    width: min(820px, 100%);
    max-height: min(760px, calc(100vh - 44px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: 0 30px 90px rgba(15, 23, 42, .26);
}

.expense-modal-header,
.expense-modal-footer {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.expense-modal-header h2 {
    margin: 2px 0 4px;
}

.expense-modal-body {
    padding: 18px;
    overflow: auto;
    display: grid;
    gap: 16px;
}

.expense-modal-footer {
    border-top: 1px solid var(--line);
    border-bottom: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
}

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

.detail-stat {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfcfe;
}

.detail-stat span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.detail-stat b {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
}

.section-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.expense-documents {
    display: grid;
    gap: 10px;
}

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

.document-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.document-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.document-row {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: #fbfcfe;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.document-row:hover {
    border-color: rgba(37, 99, 235, .32);
}

.document-row strong,
.document-row em {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-row em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
}

.document-thumb {
    width: 54px;
    aspect-ratio: 4 / 3;
    border-radius: 7px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--field);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

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

.inline-upload {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.compact-empty {
    padding: 12px;
}

.record-card {
    display: grid;
    gap: 10px;
}

.record-head,
.record-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.record-foot b {
    font-size: 20px;
}

.btn.compact {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
}

.fuel-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(88px, auto));
    gap: 10px;
    text-align: right;
}

.fuel-stats span {
    color: var(--muted);
    font-size: 12px;
}

.fuel-stats b {
    display: block;
    color: var(--ink);
    font-size: 16px;
}

.asset-card {
    position: relative;
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 12px;
    align-items: center;
    min-height: 118px;
    cursor: pointer;
    transition: border-color .16s ease, transform .16s ease;
}

.asset-card:hover {
    border-color: rgba(37, 99, 235, .32);
    transform: translateY(-1px);
}

.asset-card.hero-selected {
    border-color: rgba(37, 99, 235, .44);
    box-shadow: inset 3px 0 0 var(--blue);
}

.danger-text {
    color: #f0a59a;
}

.asset-meta-line {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

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

.asset-delete {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(17, 24, 39, .06);
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    display: grid;
    place-items: center;
    opacity: .72;
}

.asset-delete:hover {
    opacity: 1;
    color: var(--danger);
    background: rgba(170, 61, 54, .12);
}

.hero-photo-grid {
    display: grid;
    gap: 10px;
}

.hero-photo-option {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fbfcfe;
}

.hero-photo-option.selected {
    border-color: rgba(37, 99, 235, .44);
    box-shadow: inset 3px 0 0 var(--blue);
}

.hero-photo-option strong,
.hero-photo-option .meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hero-photo-thumb {
    width: 82px;
    aspect-ratio: 4 / 3;
    border-radius: 7px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: var(--field);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

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

.asset-thumb {
    width: 96px;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: #eef2f7;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.asset-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pdf-page-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    background: #fff;
}

.asset-preview-backdrop {
    z-index: 70;
}

.asset-preview-modal {
    width: min(1180px, calc(100vw - 36px));
    height: min(840px, calc(100vh - 36px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: 0 34px 100px rgba(15, 23, 42, .3);
}

.asset-preview-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.asset-preview-header h2 {
    margin: 0 0 2px;
    font-size: 18px;
}

.asset-preview-body {
    position: relative;
    min-height: 0;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .035);
    overflow: hidden;
}

.asset-preview-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.asset-preview-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 8px;
}

.asset-preview-frame {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 8px;
    background: #fff;
}

.asset-preview-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: var(--text);
    font-size: 34px;
    line-height: 1;
    background: rgba(18, 15, 8, .64);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
    transform: translateY(-50%);
    cursor: pointer;
    transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.asset-preview-nav:hover {
    border-color: rgba(252, 184, 18, .45);
    background: rgba(42, 35, 18, .86);
    transform: translateY(-50%) scale(1.04);
}

.asset-preview-nav span {
    display: block;
    width: 1em;
    height: 1em;
    line-height: .88;
    text-align: center;
    transform: translateY(-1px);
}

.asset-preview-nav.previous {
    left: 24px;
}

.asset-preview-nav.previous span {
    transform: translate(-1px, -1px);
}

.asset-preview-nav.next {
    right: 24px;
}

.asset-preview-nav.next span {
    transform: translate(1px, -1px);
}

.metric {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfaf7;
}

.metric b {
    display: block;
    font-size: 19px;
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

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

.stack {
    display: grid;
    gap: 14px;
}

.status {
    min-height: 0;
    color: var(--green);
    font-weight: 800;
    padding: 0 2px;
}

.empty {
    color: var(--muted);
    padding: 20px;
}

/* Only the loading variant lines a spinner up with its text; the other
   seventeen empty states are plain blocks and stay that way. */
.empty.is-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
}

.checkbox-line input {
    width: 18px;
    min-height: 18px;
}

.hidden {
    display: none !important;
}

@media (max-width: 980px) {
    .auth-layout,
    .dashboard,
    .split {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 42vh;
        order: -1;
    }

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .drawer {
        width: 100vw;
    }

    .metric-row,
    .info-grid,
    .form-grid,
    .overview-grid,
    .vehicle-stage,
    .hero-photo-option,
    .expense-totals,
    .expense-filter-grid,
    .expense-detail-grid,
    .inline-upload,
    .document-item,
    .expense-row,
    .expense-grid,
    .asset-grid {
        grid-template-columns: 1fr;
    }

    .document-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .expense-actions {
        justify-items: stretch;
    }

    .compact-row {
        justify-content: flex-start;
    }

    .vehicle-stage {
        min-height: 0;
    }

    .vehicle-photo-frame {
        order: -1;
        height: 260px;
    }

    .top-search {
        max-width: none;
        width: 100%;
    }

    .detail-header,
    .toolbar-card,
    .list-card,
    .timeline-item,
    .fuel-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .chip-row {
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .auth-panel,
    .content,
    .topbar,
    .sidebar {
        padding: 16px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .panel-body,
    .panel-header {
        padding: 14px;
    }

    .welcome-panel {
        min-height: 300px;
        padding: 28px;
    }

    .welcome-panel h1 {
        font-size: 34px;
    }

    .vehicle-identity h1 {
        font-size: 34px;
    }

    .vehicle-stage {
        padding: 18px;
    }

    .fuel-stats {
        width: 100%;
        grid-template-columns: 1fr;
        text-align: left;
    }

    .modal-backdrop {
        padding: 0;
        align-items: stretch;
    }

    .expense-modal {
        max-height: 100vh;
        border-radius: 0;
    }

    .asset-preview-modal {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

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

    .hero-photo-thumb {
        width: 100%;
    }

    .asset-thumb {
        width: 100%;
    }
}

/* WheelBase theme */
:root {
    --malt: #2a2312;
    --malt-2: #181309;
    --malt-3: #3a2f18;
    --sun: #ffb913;
    --sun-soft: #ffe6a3;
    --cream: #fff8e8;
    --cream-2: #f4eddc;
    --cool: #9ce6d8;
}

body {
    background:
        radial-gradient(circle at 74% 10%, rgba(255, 185, 19, .24), transparent 28%),
        radial-gradient(circle at 12% 88%, rgba(156, 230, 216, .14), transparent 30%),
        linear-gradient(135deg, #201a0d 0%, var(--malt) 42%, #11100b 100%);
    color: var(--cream);
}

.app-shell {
    min-height: 100vh;
    padding: clamp(14px, 2.6vw, 32px);
}

.dashboard {
    min-height: calc(100vh - clamp(28px, 5.2vw, 64px));
    width: min(1480px, 100%);
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(255, 185, 19, .18);
    border-radius: 18px;
    background:
        linear-gradient(90deg, rgba(42, 35, 18, .98), rgba(16, 14, 9, .98)),
        var(--malt);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .36);
}

.dashboard .sidebar,
.dashboard .topbar,
.dashboard .panel {
    background: rgba(24, 19, 9, .76);
    color: var(--cream);
}

.dashboard .sidebar {
    border-right: 1px solid rgba(255, 185, 19, .16);
    gap: 14px;
}

.dashboard .brand {
    color: var(--cream);
    font-size: 22px;
    line-height: 1;
}

.dashboard .brand-mark {
    width: 44px;
    height: 44px;
    background: var(--sun) url("/icons/wheelbase-wheel.png") center / 72% no-repeat;
    color: transparent;
    box-shadow: 0 10px 24px rgba(255, 185, 19, .22);
}

.dashboard .topbar {
    min-height: 68px;
    border-bottom-color: rgba(255, 185, 19, .14);
    justify-content: space-between;
}

.dashboard .content {
    background:
        radial-gradient(circle at 80% 0%, rgba(255, 185, 19, .11), transparent 26%),
        #120f08;
    gap: 16px;
}

.dashboard .meta,
.dashboard .vehicle-item span,
.dashboard label,
.dashboard .empty {
    color: rgba(255, 248, 232, .62);
}

.dashboard .filter-field span {
    color: rgba(255, 248, 232, .58);
}

.dashboard input,
.dashboard select,
.dashboard textarea {
    border-color: rgba(255, 185, 19, .14);
    background: rgba(255, 248, 232, .08);
    color: var(--cream);
}

.dashboard input:focus,
.dashboard select:focus,
.dashboard textarea:focus {
    border-color: rgba(255, 185, 19, .72);
    box-shadow: 0 0 0 3px rgba(255, 185, 19, .14);
}

.dashboard .search-field input {
    min-height: 38px;
    border-color: rgba(255, 185, 19, .14);
    border-radius: 999px;
    background: rgba(255, 248, 232, .09);
}

.dashboard .top-search {
    flex: 1;
    max-width: 720px;
}

.topbar-account {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* The only account control in the top bar; everything else lives in the panel
   it opens, the way the app arranges it. */
.avatar-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 185, 19, .28);
    border-radius: 999px;
    background: rgba(255, 248, 232, .08);
    color: var(--sun, #ffb913);
    cursor: pointer;
}

.avatar-btn:hover {
    border-color: rgba(255, 185, 19, .55);
    background: rgba(255, 185, 19, .16);
}

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

.avatar-initial {
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
}

.dashboard .segmented,
.dashboard .tabs {
    background: rgba(255, 248, 232, .08);
}

.dashboard .segmented button.active,
.dashboard .tab.active {
    background: var(--sun);
    color: #1a1408;
}

.dashboard .vehicle-list {
    gap: 9px;
}

.dashboard .vehicle-group {
    gap: 9px;
}

.dashboard .vehicle-group-title {
    color: var(--sun, #ffb913);
}

.sidebar-add {
    width: 100%;
    margin-top: 2px;
}

.dashboard .vehicle-item {
    border-color: rgba(255, 185, 19, .09);
    background:
        linear-gradient(135deg, rgba(255, 248, 232, .08), rgba(255, 248, 232, .035));
    color: var(--cream);
}

.dashboard .vehicle-item.active {
    border-color: rgba(255, 185, 19, .58);
    background:
        linear-gradient(135deg, rgba(255, 185, 19, .18), rgba(255, 248, 232, .06));
    box-shadow: inset 3px 0 0 var(--sun);
}

.dashboard .vehicle-item:hover {
    border-color: rgba(255, 185, 19, .38);
}

.dashboard .btn {
    border-radius: 999px;
    background: var(--sun);
    color: #1a1408;
}

.dashboard .btn.blue {
    background: var(--cool);
    color: #10241f;
}

.dashboard .btn.rust,
.dashboard .btn.danger {
    background: #ef6b4a;
    color: #fff;
}

.dashboard .btn.secondary,
.dashboard .btn.ghost {
    background: rgba(255, 248, 232, .1);
    color: var(--cream);
    border-color: rgba(255, 185, 19, .18);
}

.dashboard .panel {
    border-color: rgba(255, 185, 19, .14);
    box-shadow: none;
}

.dashboard .panel-header {
    border-bottom-color: rgba(255, 185, 19, .12);
}

.dashboard .welcome-panel,
.dashboard .detail-header {
    border-color: rgba(255, 185, 19, .14);
    background:
        radial-gradient(circle at 88% 16%, rgba(255, 185, 19, .18), transparent 26%),
        linear-gradient(135deg, rgba(255, 248, 232, .1), rgba(255, 248, 232, .04));
    color: var(--cream);
    box-shadow: none;
}

.dashboard .welcome-panel p {
    color: rgba(255, 248, 232, .68);
}

.vehicle-stage {
    min-height: 440px;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr;
    align-items: end;
    border: 1px solid rgba(255, 185, 19, .18);
    border-radius: 14px;
    background: var(--malt-2);
}

.vehicle-stage::after {
    inset: 0;
    height: auto;
    z-index: 1;
    background:
        linear-gradient(90deg, rgba(28, 21, 8, .86), rgba(42, 35, 18, .14) 55%, rgba(42, 35, 18, .34)),
        linear-gradient(180deg, transparent 32%, rgba(24, 19, 9, .84) 80%, rgba(24, 19, 9, .96));
}

.vehicle-photo-frame {
    position: absolute;
    inset: 0;
    z-index: 0;
    height: auto;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: #141007;
    box-shadow: none;
}

.vehicle-photo-frame img,
.vehicle-placeholder {
    border-radius: 0;
}

.vehicle-placeholder {
    background:
        radial-gradient(circle at 70% 34%, rgba(255, 185, 19, .22), transparent 28%),
        linear-gradient(135deg, #463715, #100d07);
}

.vehicle-placeholder span {
    background: var(--sun);
    color: #1a1408;
}

.vehicle-identity {
    z-index: 2;
    width: min(700px, 66%);
    padding: 28px;
    align-self: end;
}

.vehicle-identity h1 {
    margin-top: 5px;
    font-size: clamp(38px, 6vw, 70px);
    letter-spacing: 0;
    color: #fff;
}

.vehicle-identity h1 span {
    display: block;
    color: rgba(255, 230, 163, .86);
    font-weight: 500;
}

.vehicle-identity h1 .vehicle-brand {
    color: #fff;
    font-weight: 800;
}

.vehicle-stage .eyebrow {
    color: var(--sun);
}

.hero-actions {
    margin-top: 16px;
    gap: 8px;
}

.quiet-action {
    min-height: 32px;
    border: 1px solid rgba(255, 248, 232, .18);
    border-radius: 999px;
    padding: 0 11px;
    background: rgba(24, 19, 9, .52);
    color: rgba(255, 248, 232, .78);
    font-size: 12px;
    font-weight: 800;
    backdrop-filter: blur(10px);
}

.quiet-action:hover {
    border-color: rgba(255, 185, 19, .45);
    color: var(--cream);
}

.quiet-action.muted-action {
    color: rgba(255, 210, 186, .72);
}

.hero-metrics {
    z-index: 2;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    align-self: end;
    padding: 0 28px 26px;
    margin-top: -14px;
}

.hero-metrics .metric,
.hero-metrics .metric.dark {
    border: 0;
    border-left: 2px solid rgba(255, 185, 19, .45);
    border-radius: 0;
    background: transparent;
    color: #fff;
    padding: 0 0 0 12px;
}

.hero-metrics .metric b {
    font-size: 18px;
}

.hero-metrics .metric .meta,
.hero-metrics .metric.dark .meta {
    color: rgba(255, 248, 232, .64);
}

.subnav {
    border: 1px solid rgba(255, 185, 19, .13);
    border-radius: 14px;
    background: rgba(24, 19, 9, .82);
    padding: 5px;
}

.subnav button {
    min-height: 38px;
    border: 0;
    border-radius: 999px;
}

.subnav button.active {
    background: var(--sun);
    color: #1a1408;
}

.dashboard .info-item,
.dashboard .toolbar-card,
.dashboard .list-card,
.dashboard .timeline-item,
.dashboard .fuel-card,
.dashboard .record-card,
.dashboard .expense-row,
.dashboard .asset-card,
.dashboard .metric {
    border-color: rgba(255, 185, 19, .12);
    background:
        linear-gradient(135deg, rgba(255, 248, 232, .08), rgba(255, 248, 232, .04));
    color: var(--cream);
}

.dashboard .fuel-stats b,
.dashboard .record-foot b {
    color: var(--cream);
}

.dashboard .chip {
    background: rgba(255, 185, 19, .14);
    color: var(--sun-soft);
}

.dashboard .chip.strong {
    background: var(--sun);
    color: #1a1408;
}

.dashboard .asset-thumb {
    background: rgba(255, 248, 232, .08);
    color: rgba(255, 248, 232, .68);
}

.dashboard .asset-meta-line {
    color: rgba(255, 248, 232, .58);
}

.dashboard .asset-delete {
    background: rgba(255, 248, 232, .06);
    color: rgba(255, 248, 232, .54);
}

.dashboard .asset-delete:hover {
    background: rgba(240, 165, 154, .12);
    color: #f0a59a;
}

.dashboard .expense-totals span,
.dashboard .detail-stat,
.dashboard .document-row {
    border-color: rgba(255, 185, 19, .12);
    background:
        linear-gradient(135deg, rgba(255, 248, 232, .08), rgba(255, 248, 232, .035));
    color: var(--cream);
}

.dashboard .expense-totals b,
.dashboard .detail-stat b {
    color: #fff;
}

.dashboard .modal-backdrop {
    background: rgba(8, 6, 3, .62);
}

.dashboard .asset-preview-modal {
    border-color: rgba(255, 185, 19, .16);
    background: var(--malt-2);
    color: var(--cream);
    box-shadow: 0 34px 100px rgba(0, 0, 0, .46);
}

.dashboard .asset-preview-header {
    border-color: rgba(255, 185, 19, .12);
}

.dashboard .asset-preview-body {
    background: rgba(8, 6, 3, .32);
}

.dashboard .expense-modal {
    border-color: rgba(255, 185, 19, .16);
    background: var(--malt-2);
    color: var(--cream);
    box-shadow: 0 34px 100px rgba(0, 0, 0, .44);
}

/* The account panel and the password form sit on a modal-card, and this is
   the only modal that never got the dark treatment: its labels, ghost buttons
   and inputs are all styled for a dark surface by the rules above, so on the
   white default card they were cream on white and could not be read. */
.dashboard .modal-card {
    border-color: rgba(255, 185, 19, .16);
    background: var(--malt-2);
    color: var(--cream);
    box-shadow: 0 34px 100px rgba(0, 0, 0, .46);
}

/* .dashboard .btn.ghost is two classes and beats .danger-text on its own, so
   the one destructive button in here came out the same colour as the rest. */
.dashboard .btn.ghost.danger-text {
    color: #f0a59a;
}

.dashboard .btn.ghost.danger-text:hover {
    background: rgba(239, 107, 74, .16);
}

.dashboard .account-actions,
.dashboard .readonly-value {
    border-color: rgba(255, 185, 19, .12);
}

.dashboard .readonly-value {
    background: rgba(255, 248, 232, .06);
    color: rgba(255, 248, 232, .68);
}

.dashboard .expense-modal-header,
.dashboard .expense-modal-footer {
    border-color: rgba(255, 185, 19, .12);
}

.dashboard .document-thumb {
    background: rgba(255, 248, 232, .08);
    color: rgba(255, 248, 232, .68);
}

.dashboard .hero-photo-option {
    border-color: rgba(255, 185, 19, .12);
    background:
        linear-gradient(135deg, rgba(255, 248, 232, .08), rgba(255, 248, 232, .035));
    color: var(--cream);
}

.dashboard .hero-photo-option.selected {
    border-color: rgba(255, 185, 19, .52);
    box-shadow: inset 3px 0 0 var(--sun);
}

.dashboard .hero-photo-thumb {
    background: rgba(255, 248, 232, .08);
    color: rgba(255, 248, 232, .68);
}

.dashboard .hero-metrics .metric,
.dashboard .hero-metrics .metric.dark {
    border: 1px solid rgba(255, 248, 232, .11);
    border-left: 4px solid rgba(255, 185, 19, .72);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 248, 232, .075), rgba(255, 248, 232, .025));
    color: var(--cream);
    padding: 12px 13px;
    box-shadow: inset 0 1px 0 rgba(255, 248, 232, .08), 0 12px 28px rgba(0, 0, 0, .08);
    backdrop-filter: blur(18px);
}

.dashboard .hero-metrics .metric b {
    color: #fff;
}

.auth-layout {
    min-height: calc(100vh - clamp(28px, 5.2vw, 64px));
    overflow: hidden;
    border: 1px solid rgba(255, 185, 19, .18);
    border-radius: 18px;
    background:
        linear-gradient(90deg, rgba(24, 19, 9, .98), rgba(42, 35, 18, .92)),
        var(--malt);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .34);
}

.auth-panel {
    border-right-color: rgba(255, 185, 19, .14);
    background:
        linear-gradient(135deg, rgba(255, 248, 232, .08), rgba(255, 248, 232, .035)),
        rgba(24, 19, 9, .78);
    color: var(--cream);
}

.auth-panel .brand {
    color: var(--cream);
}

.auth-panel .brand-mark {
    background: var(--sun) url("/icons/wheelbase-wheel.png") center / 72% no-repeat;
    color: transparent;
    box-shadow: 0 10px 24px rgba(255, 185, 19, .22);
}

.auth-panel .tabs {
    background: rgba(255, 248, 232, .08);
}

.auth-panel .tab {
    color: rgba(255, 248, 232, .62);
}

.auth-panel .tab.active {
    background: var(--sun);
    color: #1a1408;
}

.auth-panel label {
    color: rgba(255, 248, 232, .62);
}

.auth-panel input,
.auth-panel select {
    border-color: rgba(255, 185, 19, .14);
    background: rgba(255, 248, 232, .08);
    color: var(--cream);
}

.auth-panel input:focus,
.auth-panel select:focus {
    border-color: rgba(255, 185, 19, .72);
    box-shadow: 0 0 0 3px rgba(255, 185, 19, .14);
}

.auth-panel .btn {
    border-radius: 999px;
    background: var(--sun);
    color: #1a1408;
}

.auth-panel .status {
    color: var(--sun);
}

.auth-visual {
    background:
        radial-gradient(circle at 24% 18%, rgba(255, 185, 19, .24), transparent 28%),
        linear-gradient(135deg, #2a2312, #121008 68%);
}

.auth-visual::before {
    content: "";
    position: absolute;
    inset: 7% 6% auto auto;
    width: min(460px, 54vw);
    aspect-ratio: 1;
    border-radius: 50%;
    background: url("/icons/wheelbase-wheel.png") center / contain no-repeat;
    opacity: .16;
    filter: drop-shadow(0 24px 50px rgba(0, 0, 0, .35));
}

.auth-visual::after {
    content: "";
    position: absolute;
    left: clamp(32px, 8vw, 110px);
    right: clamp(32px, 8vw, 110px);
    bottom: clamp(140px, 18vw, 230px);
    height: 1px;
    background: linear-gradient(90deg, var(--sun), transparent);
    opacity: .62;
}

.auth-copy {
    z-index: 1;
}

.auth-copy h1 {
    color: #fff;
}

.auth-copy p {
    color: rgba(255, 248, 232, .76);
}

.spec-list {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
}

.spec-row {
    display: grid;
    grid-template-columns: minmax(110px, .58fr) minmax(0, 1fr);
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid rgba(255, 185, 19, .1);
}

.spec-row dt {
    color: rgba(255, 248, 232, .56);
    font-size: 12px;
    font-weight: 800;
}

.spec-row dd {
    margin: 0;
    color: var(--cream);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.dashboard th,
.dashboard td {
    border-bottom-color: rgba(255, 185, 19, .12);
}

.dashboard th {
    color: rgba(255, 248, 232, .56);
}

.dashboard .status {
    color: var(--sun);
}

.form-busy {
    min-height: 44px;
    border: 1px solid rgba(255, 185, 19, .2);
    border-radius: 8px;
    padding: 10px 12px;
    background:
        linear-gradient(135deg, rgba(255, 248, 232, .12), rgba(255, 248, 232, .045));
    color: var(--sun-soft);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}

.spinner {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 2px solid rgba(255, 248, 232, .28);
    border-top-color: var(--sun);
    border-radius: 50%;
    display: inline-block;
    animation: spin .8s linear infinite;
}

form[data-busy="true"] {
    opacity: .9;
}

form[data-busy="true"] button[type="submit"] {
    gap: 9px;
}

form[data-busy="true"] input,
form[data-busy="true"] select,
form[data-busy="true"] textarea,
form[data-busy="true"] button {
    cursor: progress;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.drawer {
    background: var(--malt-2);
    color: var(--cream);
}

.drawer-header {
    border-bottom-color: rgba(255, 185, 19, .14);
}

.drawer .panel,
.drawer .panel-body {
    background: transparent;
}

.icon-btn {
    background: rgba(255, 248, 232, .1);
    color: var(--cream);
}

@media (max-width: 980px) {
    .app-shell {
        padding: 0;
    }

    .dashboard {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .auth-layout {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .vehicle-identity {
        width: 100%;
    }

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

    .topbar-account {
        width: 100%;
    }

    .spec-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .vehicle-stage {
        min-height: 520px;
    }

    .vehicle-identity {
        padding: 18px;
    }

    .hero-metrics {
        grid-template-columns: 1fr;
        padding: 0 18px 18px;
    }
}

/* ---------------------------------------------------------------------------
   Multi-page PDF viewer

   Pages are rendered on the server and shown as images in a scrolling column.
   --------------------------------------------------------------------------- */

.asset-preview-body:has(.pdf-viewer-shell) {
    align-items: stretch;
    overflow: hidden;
}

.pdf-viewer-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}

.pdf-viewer {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 4px;
    scroll-behavior: smooth;
}

.pdf-page {
    position: relative;
    width: 100%;
    max-width: 900px;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .22);
}

.pdf-page img {
    display: block;
    width: 100%;
    height: auto;
}

.pdf-page-number {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(15, 12, 5, .74);
    color: #fff8e8;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
}

.pdf-viewer-status:empty {
    display: none;
}

.pdf-viewer-status {
    padding: 10px 4px 2px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.pdf-download {
    align-self: center;
    margin-top: 8px;
}

/* ---------------------------------------------------------------------------
   Account panel, password form and member actions
   --------------------------------------------------------------------------- */

.modal-card {
    width: min(100%, 460px);
    max-height: 92vh;
    overflow-y: auto;
    padding: 0 20px 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel, #fff);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .4);
}

.modal-card .asset-preview-header {
    padding: 16px 0 12px;
}

.modal-card form {
    display: grid;
    gap: 10px;
}

.account-panel {
    width: min(100%, 460px);
}

.avatar-editor {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-preview {
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 185, 19, .28);
    border-radius: 999px;
    background: rgba(255, 248, 232, .08);
    color: var(--sun, #ffb913);
}

.avatar-preview .avatar-initial {
    font-size: 24px;
}

.avatar-editor-actions {
    flex: 1;
}

/* The address cannot be changed here, so it is shown rather than offered as a
   field that refuses to be edited. */
.readonly-value {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 248, 232, .05);
    color: var(--muted);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.account-actions {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.account-actions form {
    margin-bottom: 4px;
}

.disclosure-caret {
    margin-left: 6px;
    font-size: 10px;
    opacity: .7;
}

.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.btn.link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--gold, #ffb913);
    font-weight: 800;
    text-decoration: underline;
    cursor: pointer;
    min-height: 0;
}

/* ---------------------------------------------------------------------------
   Vehicle list thumbnails

   The sidebar was text-only, so picking a vehicle meant reading every brand
   and model. A small photo makes the list scannable at a glance.
   --------------------------------------------------------------------------- */

.vehicle-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vehicle-thumb {
    flex: none;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 9px;
    overflow: hidden;
    background: rgba(120, 147, 109, .16);
}

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

.vehicle-thumb-fallback {
    font-size: 18px;
    font-weight: 900;
    color: var(--muted);
}

.vehicle-item-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.vehicle-item-meta {
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard .vehicle-thumb {
    background: rgba(255, 185, 19, .14);
}

.dashboard .vehicle-thumb-fallback {
    color: #ffd76f;
}

/* ── insights ─────────────────────────────────────────────────────────────
 * The charts are inline SVG drawn in a fixed 640-wide coordinate space, so
 * everything here is about colour and spacing; nothing scales the geometry.
 */

.insights {
    display: grid;
    gap: 16px;
}

.stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.stat-tile {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    padding: 14px 16px;
    display: grid;
    gap: 2px;
    align-content: start;
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-value {
    font-size: 22px;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-hint {
    color: var(--muted);
    font-size: 12px;
}

.chart-panel .panel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.chart-note {
    color: var(--muted);
    font-size: 13px;
    padding: 2px 2px 0;
}

.chart {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart-grid {
    stroke: var(--line);
    stroke-width: 1;
}

.chart-tick {
    fill: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.chart-bar {
    fill: var(--blue);
}

.chart-fill {
    fill: var(--soft-blue);
}

.chart-line {
    fill: none;
    stroke: var(--blue);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* The measured figure sits behind the trend it is being read against. */
.chart-line.faint {
    stroke: var(--line);
    stroke-width: 1.5;
}

.chart-line.trend {
    stroke: var(--rust);
}

.chart-dot {
    fill: var(--blue);
}

.category-bars {
    display: grid;
    gap: 10px;
}

.category-row {
    display: grid;
    grid-template-columns: minmax(84px, 1fr) minmax(60px, 3fr) auto 38px;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

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

.category-track {
    background: var(--field);
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.category-fill {
    display: block;
    height: 100%;
    background: var(--blue);
    border-radius: 999px;
}

/* Fuel is the one running cost that is not a decision, so it reads apart. */
.category-fill.fuel {
    background: var(--amber);
}

.category-value {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.category-share {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.table.compact th,
.table.compact td {
    padding: 8px 10px;
}

.table .right,
.table th.right {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
    .category-row {
        grid-template-columns: 1fr auto 38px;
    }

    .category-track {
        grid-column: 1 / -1;
        order: 3;
    }
}

/* ── busy overlay ─────────────────────────────────────────────────────────
 * Added to <body> rather than rendered into the app shell: re-rendering would
 * destroy the element the user just clicked, and the overlay has to survive
 * until the work is done.
 */

body.is-busy::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(8, 7, 10, .55);
    /* A spinner that flashes for eighty milliseconds reads as a glitch, so
       anything the server answers quickly still looks instant. */
    animation: busy-fade-in .1s linear .28s both;
}

body.is-busy::before {
    content: "";
    position: fixed;
    z-index: 61;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 3px solid rgba(255, 248, 232, .22);
    border-top-color: var(--sun);
    border-radius: 50%;
    box-shadow: var(--shadow);
    animation: spin .8s linear infinite, busy-fade-in .1s linear .28s both;
}

@keyframes busy-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.empty.notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
