:root {
    --bg: #eef2f7;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --header: #101828;
    --header-2: #1d2939;
    --accent: #f59e0b;
    --accent-dark: #b45309;
    --blue: #2563eb;
    --danger: #dc2626;
    --ok: #16a34a;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 14px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.18);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

[hidden] { display: none !important; }

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

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

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

/* ---------- buttons / inputs ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 46px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 15px;
    transition: transform 0.06s ease, background 0.15s ease, opacity 0.15s ease;
    user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; pointer-events: none; }
.btn--primary { background: var(--accent); color: #1f2937; }
.btn--primary:hover { background: #fbbf24; }
.btn--ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--block { width: 100%; }
.btn--nav {
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 10px 12px;
    min-width: 96px;
    font-size: 14px;
}
.btn--nav-next { background: #1d2939; color: #fff; border-color: #1d2939; }
.btn--nav-next.btn--archive { background: var(--accent); color: #1f2937; border-color: var(--accent); }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
    flex: 0 0 auto;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
.icon-btn--danger { color: #fca5a5; }
.sheet .icon-btn { color: var(--text); background: var(--surface-2); }
.sheet .icon-btn:hover { background: var(--border); }

.input {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    font-size: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.input:disabled { background: var(--surface-2); color: var(--muted); }
.input--plate {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 2px;
    text-align: center;
    text-transform: uppercase;
}

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.form-message { min-height: 20px; font-size: 14px; color: var(--danger); margin-top: 4px; }

/* ---------- auth ---------- */

.auth-screen {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px calc(24px + var(--safe-bottom));
    background: linear-gradient(180deg, #101828 0%, #1d2939 55%, #eef2f7 55%, #eef2f7 100%);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 26px 22px 22px;
}
.auth-logo { text-align: center; margin-bottom: 8px; }
.auth-logo svg { border-radius: 16px; }
.auth-title { margin: 0; text-align: center; font-size: 24px; letter-spacing: -0.02em; }
.auth-subtitle { margin: 4px 0 20px; text-align: center; color: var(--muted); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; }
.auth-message { min-height: 22px; margin-top: 10px; text-align: center; font-size: 14px; color: var(--danger); }
.auth-message--ok { color: var(--ok); }

/* ---------- app header ---------- */

#appScreen { min-height: 100dvh; }

#appHeader {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--header);
    color: #fff;
    padding: calc(8px + var(--safe-top)) 12px 10px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.22);
}
.header-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.header-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; letter-spacing: -0.01em; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18); }
.header-actions { display: flex; align-items: center; gap: 6px; }

.offline-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(220, 38, 38, 0.2);
    color: #fecaca;
}

.user-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--accent);
    color: #1f2937;
    font-weight: 800;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-wrap { position: relative; margin-top: 10px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
#searchInput {
    width: 100%;
    min-height: 46px;
    padding: 11px 40px 11px 38px;
    font-size: 16px;
    border-radius: 12px;
    border: none;
    background: #fff;
    color: var(--text);
    outline: none;
}
#searchInput::-webkit-search-cancel-button { display: none; }
.clear-search {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: var(--surface-2);
}

.chips {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding: 10px 0 2px;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s ease;
}
.chip:active { transform: scale(0.97); }
.chip--active { background: #fff; color: var(--header); }
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sc, #94a3b8); }
.chip__count {
    font-size: 11px;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.18);
    border-radius: 999px;
    padding: 1px 5px;
    min-width: 17px;
    text-align: center;
}
.chip__count--warn { background: #f59e0b; color: #1f2937; }
.chip--active .chip__count { background: rgba(15, 23, 42, 0.1); }
.chip__icon { opacity: 0.9; }

/* ---------- list ---------- */

#mainContent {
    max-width: 760px;
    margin: 0 auto;
    padding: 12px 12px calc(110px + var(--safe-bottom));
}

.cars-list { display: flex; flex-direction: column; }

.status-section { margin-bottom: 18px; }
.status-section__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 2px 8px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.status-section__chevron { margin-left: auto; transition: transform 0.15s ease; }
.status-section--collapsed .status-section__chevron { transform: rotate(-90deg); }
.status-section--collapsed .status-section__cards { display: none; }
.status-section__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sc); }
.status-section__count {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 12px;
}
.status-section--empty { display: none; }

.car-card {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
    text-align: left;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 9px;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.8);
}
.car-card:active { background: var(--surface-2); }
.car-card__bar { flex: 0 0 5px; background: var(--sc, #94a3b8); }
.car-card__main { flex: 1 1 auto; min-width: 0; padding: 10px 6px 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.car-card__top { display: flex; align-items: center; gap: 8px; }
.car-card__plate { font-size: 19px; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap; }
.car-card__sub { font-size: 13.5px; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car-card__meta { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car-card__days {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    border: 1px solid var(--border);
}
.car-card__days--over { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.car-card__next {
    flex: 0 0 auto;
    width: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 300;
    color: #94a3b8;
    border-left: 1px solid var(--border);
    user-select: none;
}
.car-card__next:active { background: var(--surface-2); color: var(--text); }
.car-card__next--final { color: var(--accent-dark); font-size: 22px; }

.empty-state {
    text-align: center;
    padding: 56px 20px;
    color: #94a3b8;
}
.empty-state p { margin: 10px 0 0; font-weight: 600; color: var(--muted); }
.empty-state .muted { font-weight: 400; font-size: 14px; }

.archive-info {
    font-size: 13px;
    color: var(--muted);
    padding: 4px 4px 10px;
}

/* ---------- settlements cards ---------- */

.settle-cards { display: flex; flex-direction: column; }

.settle-card {
    position: relative;
    display: flex;
    align-items: stretch;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    margin-bottom: 10px;
    overflow: hidden;
    transition: box-shadow 0.15s ease;
}
.settle-card__bar { flex: 0 0 5px; background: #64748b; }
.settle-card__body { flex: 1 1 auto; min-width: 0; padding: 12px 14px 13px; }
.settle-card__head { display: flex; align-items: center; gap: 9px; }
.settle-card__lp { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 18px; }
.settle-card__model { font-size: 13.5px; color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settle-card__head .settle-toggle { margin-left: auto; flex: 0 0 auto; }
.settle-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 9px;
}
.settle-card__meta-text {
    font-size: 12.5px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}
.settle-badge {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 999px;
    white-space: nowrap;
}
.settle-badge--done { background: #dcfce7; color: #15803d; }
.settle-badge--todo { background: #fef3c7; color: #b45309; }
.settle-badge--missing { background: #fee2e2; color: #b91c1c; }
.settle-card__fields {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr 1fr;
    gap: 8px 10px;
    align-items: end;
    border-top: 1px solid var(--border);
    padding-top: 11px;
}
.settle-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.settle-field > span {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.settle-field--total, .settle-field--diff { text-align: right; }
.settle-plate {
    display: inline-block;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.02em;
    color: var(--text);
    padding: 3px 8px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.settle-plate:hover { border-color: var(--blue); color: var(--blue); }
.settle-input {
    width: 100%;
    min-height: 36px;
    padding: 6px 9px;
    font-size: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    outline: none;
}
.settle-input:hover { background: #fff; }
.settle-input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.settle-input--money { text-align: right; }
.settle-input:disabled { opacity: 0.6; }
.settle-input:placeholder-shown:not(:focus) {
    background: #fff7ed;
    border-color: #fdba74;
}
.settle-input--text:placeholder-shown:not(:focus) {
    background: #fef2f2;
    border-color: #fca5a5;
}
.settle-total {
    display: block;
    font-weight: 800;
    font-size: 14px;
    min-height: 36px;
    padding: 8px 9px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    white-space: nowrap;
}
.settle-total--short { color: #b45309; }
.settle-diff {
    display: block;
    font-weight: 800;
    font-size: 14px;
    min-height: 36px;
    padding: 8px 9px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    white-space: nowrap;
}
.settle-diff--short { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.settle-diff--over { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.settle-toggle {
    width: 42px;
    height: 36px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 14px;
    border: 1px solid transparent;
}
.settle-toggle--on { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.settle-toggle--off { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.settle-card--done { opacity: 0.55; }

.settle-summary {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    padding: 14px;
    margin-top: 4px;
}
.settle-summary__title {
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 8px;
}
.settle-summary__grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    align-items: end;
}
.settle-summary .settle-field b {
    display: block;
    font-size: 13.5px;
    padding: 7px 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    white-space: nowrap;
    text-align: right;
}
.settle-summary .settle-field--total b { font-size: 14.5px; }
.settle-summary__info {
    margin-top: 8px;
    font-size: 11.5px;
    color: var(--muted);
}

@media (max-width: 719px) {
    .settle-card__fields { grid-template-columns: 1fr 1fr; }
    .settle-field--fv { grid-column: 1 / -1; order: -1; }
    .settle-field--diff { grid-column: 1 / -1; }
    .settle-summary__grid { grid-template-columns: 1fr 1fr; }
    .settle-summary .settle-field:last-child { grid-column: 1 / -1; }
}

/* ---------- photos ---------- */

.photo-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.photo-count { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.photo-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.photo-tile {
    position: relative;
    display: block;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface-2);
    aspect-ratio: 4 / 3;
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile:active { transform: scale(0.98); }
.photo-empty {
    padding: 14px 4px 4px;
    font-size: 13.5px;
    color: var(--muted);
}

.photo-progress { margin-top: 8px; }
.photo-progress span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.photo-progress__bar {
    height: 6px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}
.photo-progress__bar i { display: block; height: 100%; width: 0; background: var(--blue); transition: width 0.2s ease; }

.photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.photo-viewer__backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, 0.92); }
.photo-viewer__top {
    position: absolute;
    top: calc(10px + var(--safe-top));
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    z-index: 2;
    color: #e2e8f0;
}
.photo-viewer__counter { font-weight: 700; font-size: 14px; }
.photo-viewer__btn {
    margin-left: auto;
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13.5px;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}
.photo-viewer__btn--close { margin-left: 0; width: 38px; height: 38px; padding: 0; font-size: 16px; }
.photo-viewer__stage {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: 76vh;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
}
.photo-viewer__stage img {
    max-width: 100%;
    max-height: 76vh;
    object-fit: contain;
    border-radius: 8px;
}
.photo-viewer__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 44px;
    height: 60px;
    border-radius: 12px;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    background: rgba(255, 255, 255, 0.12);
}
.photo-viewer__nav--prev { left: 8px; }
.photo-viewer__nav--next { right: 8px; }
.photo-viewer__nav:active { background: rgba(255, 255, 255, 0.22); }

@media (min-width: 720px) {
    .photo-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ---------- fab ---------- */

.fab {
    position: fixed;
    right: 18px;
    bottom: calc(18px + var(--safe-bottom));
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--accent);
    color: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 22px rgba(180, 83, 9, 0.4);
    z-index: 25;
    transition: transform 0.08s ease;
}
.fab:active { transform: scale(0.94); }

/* ---------- install banner ---------- */

.install-banner {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(14px + var(--safe-bottom));
    width: min(560px, calc(100vw - 20px));
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 10px 12px;
    z-index: 40;
    animation: pop-in 0.18s ease;
}
.install-banner__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.install-banner__text strong { font-size: 14px; }
.install-banner__text span { font-size: 12.5px; color: var(--muted); }
.install-banner .btn { flex: 0 0 auto; padding: 8px 12px; min-height: 38px; }
.install-banner__close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    background: var(--surface-2);
    font-size: 16px;
    line-height: 1;
}
body.install-banner-open .fab { bottom: calc(96px + var(--safe-bottom)); }
body.install-banner-open #mainContent { padding-bottom: calc(200px + var(--safe-bottom)); }

/* ---------- popover ---------- */

.popover {
    position: fixed;
    top: calc(58px + var(--safe-top));
    right: 10px;
    z-index: 60;
    width: min(280px, calc(100vw - 20px));
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    animation: pop-in 0.12s ease;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
.popover-user { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.popover-name { font-weight: 700; }
.popover-role { font-size: 13px; color: var(--muted); }
.menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item--danger { color: var(--danger); }

/* ---------- sheets ---------- */

.sheet { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.52); animation: fade-in 0.15s ease; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    max-height: 92dvh;
    background: var(--bg);
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-lg);
    animation: sheet-up 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.sheet-panel--full { height: 100dvh; max-height: 100dvh; border-radius: 0; }

.sheet-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(10px + var(--safe-top)) 12px 10px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}
.sheet-panel--full .sheet-header { padding-top: calc(10px + var(--safe-top)); }
.sheet-title { flex: 1 1 auto; min-width: 0; }
.sheet-heading { font-weight: 800; font-size: 17px; }
.sheet-plate { font-weight: 800; font-size: 21px; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-header-right { display: flex; align-items: center; gap: 8px; }
.save-state { font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.save-state--saving { color: var(--blue); }
.save-state--saved { color: var(--ok); }
.save-state--error { color: var(--danger); }

.sheet-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 12px calc(20px + var(--safe-bottom));
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
}

.sheet-footer {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(90px, auto) 1fr minmax(90px, auto);
    align-items: center;
    gap: 8px;
    padding: 10px 12px calc(10px + var(--safe-bottom));
    background: var(--surface);
    border-top: 1px solid var(--border);
}
.sheet-footer--single { display: block; }

/* ---------- car modal ---------- */

.card-block {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 12px;
}
.card-block__title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-block__title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: var(--sc, #64748b);
    white-space: nowrap;
}
.status-badge__days { opacity: 0.85; font-weight: 600; }

.timeline { position: relative; padding-left: 4px; }
.timeline__item { position: relative; display: flex; gap: 12px; padding-bottom: 16px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__line { position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--border); }
.timeline__item:last-child .timeline__line { display: none; }
.timeline__dot {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    margin-top: 1px;
}
.timeline__dot--done { border-color: var(--sc); background: var(--sc); }
.timeline__dot--done::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }
.timeline__dot--current { border-color: var(--sc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sc) 22%, transparent); }
.timeline__dot--current::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sc); }
.timeline__content { flex: 1; min-width: 0; }
.timeline__status { font-weight: 700; font-size: 14.5px; }
.timeline__arrow { color: var(--muted); font-weight: 600; }
.timeline__time { font-size: 13px; color: var(--muted); }
.timeline__note { font-size: 13px; color: #475569; margin-top: 2px; }
.timeline__actor { font-size: 12px; color: var(--muted); }

.status-progress { text-align: center; min-width: 0; }
.dots { display: flex; align-items: center; justify-content: center; gap: 7px; margin-bottom: 4px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); transition: all 0.2s ease; }
.dot--done { background: var(--dc, #94a3b8); }
.dot--current { width: 13px; height: 13px; background: var(--dc, #64748b); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dc) 22%, transparent); }
.dot--final { border-radius: 3px; }
.days-current { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.days-current--over { color: var(--danger); }

.info-banner {
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13.5px;
    color: #475569;
    margin-bottom: 12px;
}

/* ---------- admin ---------- */

.admin-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
}
.admin-tab {
    flex: 1;
    padding: 9px 6px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    color: var(--muted);
    background: var(--surface-2);
}
.admin-tab--active { background: var(--header); color: #fff; }

.admin-section { margin-bottom: 16px; }
.admin-heading { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 4px 2px 8px; }

.user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
    margin-bottom: 8px;
}
.user-row__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--header);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex: 0 0 auto;
}
.user-row__main { flex: 1 1 auto; min-width: 0; }
.user-row__name { font-weight: 700; }
.user-row__meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row__badges { display: flex; gap: 5px; margin-top: 3px; flex-wrap: wrap; }
.badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
}
.badge--admin { background: #fef3c7; border-color: #fde68a; color: var(--accent-dark); }
.badge--ok { background: #dcfce7; border-color: #bbf7d0; color: #15803d; }
.badge--off { background: #fee2e2; border-color: #fecaca; color: #b91c1c; }
.user-row__actions { display: flex; gap: 6px; }
.small-btn {
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    background: var(--surface-2);
    border: 1px solid var(--border);
}
.small-btn--danger { color: var(--danger); border-color: #fecaca; background: #fef2f2; }

.user-form {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 14px;
}
.user-form__actions { display: flex; gap: 8px; margin-top: 6px; }

.tab-checks { display: flex; gap: 16px; padding: 8px 0 2px; flex-wrap: wrap; }
.tab-checks label { display: inline-flex; align-items: center; gap: 7px; font-size: 14.5px; font-weight: 600; color: var(--text); }
.tab-checks input { width: 18px; height: 18px; accent-color: var(--blue); }

.generated-password {
    margin-top: 8px;
    padding: 10px 12px;
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.generated-password code { font-weight: 800; font-size: 15px; user-select: all; }

.audit-filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.audit-row {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 11px 12px;
    margin-bottom: 8px;
}
.audit-row__top { display: flex; align-items: baseline; gap: 8px; }
.audit-row__action { font-weight: 700; font-size: 14px; }
.audit-row__time { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.audit-row__meta { font-size: 13px; color: #475569; margin-top: 2px; }
.audit-row__details { font-size: 12.5px; color: var(--muted); margin-top: 4px; word-break: break-word; }

/* ---------- confirm / toast ---------- */

.sheet--center { justify-content: center; align-items: center; padding: 20px; }
.confirm-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 18px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    animation: pop-in 0.15s ease;
}
.confirm-box h3 { margin: 0 0 6px; font-size: 18px; }
.confirm-box p { margin: 0 0 14px; font-size: 14.5px; }
.confirm-extra { margin-bottom: 12px; }
.confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.confirm-actions .btn { min-width: 110px; }

.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(92px + var(--safe-bottom));
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: calc(100vw - 28px);
    padding: 12px 16px;
    border-radius: 12px;
    background: #1d2939;
    color: #fff;
    font-size: 14.5px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    animation: pop-in 0.15s ease;
}
.toast--error { background: #7f1d1d; }
.toast-action {
    color: #fbbf24;
    font-weight: 800;
    font-size: 14px;
    padding: 4px 6px;
    flex: 0 0 auto;
}

/* ---------- desktop ---------- */

@media (min-width: 720px) {
    #appHeader { padding-left: max(16px, calc((100vw - 760px) / 2)); padding-right: max(16px, calc((100vw - 760px) / 2)); }
    .chips { margin: 0; padding-left: 0; padding-right: 0; }
    .sheet-panel { border-radius: 20px 20px 0 0; }
    .sheet-panel--full { max-height: 96dvh; height: 96dvh; border-radius: 20px 20px 0 0; margin-top: 4dvh; }
    .sheet-header { border-radius: 20px 20px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

@media print {
    #appHeader, .fab, .sheet-footer, .toast { display: none !important; }
}
