:root {
    --ink: #111827;
    --muted: #64748b;
    --line: #dbe7f3;
    --surface: rgba(255, 255, 255, 0.92);
    --soft: #f6faff;
    --blue: #2563eb;
    --sky: #0284c7;
    --green: #059669;
    --amber: #d97706;
    --red: #dc2626;
    --shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 246, 255, 0.94) 44%, rgba(247, 252, 249, 0.98)),
        linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px),
        linear-gradient(0deg, rgba(5, 150, 105, 0.035) 1px, transparent 1px);
    background-size: auto, 42px 42px, 42px 42px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

a {
    color: var(--blue);
    text-decoration: none;
}

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

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 74px;
    padding: 10px 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 251, 255, 0.93));
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(16px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink);
    min-width: 190px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #fff;
    font-weight: 850;
    background: linear-gradient(135deg, var(--blue), var(--sky) 62%, var(--green));
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.brand-mark.large {
    width: 54px;
    height: 54px;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: var(--muted);
    margin-top: 1px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    flex-wrap: wrap;
}

.nav-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #334155;
    font-weight: 720;
}

.nav-link:hover,
.nav-link.active {
    color: #1d4ed8;
    background: linear-gradient(180deg, #f4f9ff, #e9f3ff);
    border-color: #cfe2ff;
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 10px;
    color: #334155;
}

.user-box span,
.user-box small {
    display: block;
}

.user-box small {
    color: var(--muted);
}

.page {
    padding: 24px;
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin: -24px -24px 24px;
    padding: 22px 24px;
    background: linear-gradient(120deg, rgba(255,255,255,0.94), rgba(239,246,255,0.88) 74%, rgba(236,253,245,0.72));
    border-bottom: 1px solid var(--line);
}

.page-title h1 {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.15;
}

.page-title p,
.muted,
.empty,
.small-note {
    color: var(--muted);
}

.page-title p {
    margin: 5px 0 0;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.panel + .panel,
.two-columns + .panel,
.two-columns + .two-columns {
    margin-top: 16px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.panel-head h2,
.vehicle-card h2,
.mini h2 {
    margin: 0;
    font-size: 1.08rem;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.kpi {
    min-height: 130px;
    display: grid;
    gap: 5px;
    align-content: center;
    padding: 18px;
    border-radius: 8px;
    color: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.13);
}

.kpi:hover {
    color: #fff;
    transform: translateY(-1px);
}

.kpi strong {
    font-size: clamp(1.4rem, 2.3vw, 2.1rem);
    line-height: 1;
}

.kpi small,
.kpi span {
    color: rgba(255,255,255,0.88);
}

.kpi.good { background: linear-gradient(135deg, #047857, #12b981); }
.kpi.info { background: linear-gradient(135deg, #1d4ed8, #0284c7); }
.kpi.bad { background: linear-gradient(135deg, #be123c, #ef4444); }
.kpi.warn { background: linear-gradient(135deg, #b45309, #f59e0b); }

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.simple-list,
.status-list,
.tip-list {
    display: grid;
    gap: 10px;
}

.status-list a,
.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px;
    border: 1px solid #e4edf7;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.status-list a span,
.list-row div {
    display: grid;
    gap: 3px;
}

.status-dot {
    width: 10px;
    height: 10px;
    display: inline-block;
    border-radius: 50%;
    margin-right: 8px;
}

.status-dot.good { background: var(--green); }
.status-dot.info { background: var(--blue); }
.status-dot.warn { background: var(--amber); }
.status-dot.bad { background: var(--red); }
.status-dot.neutral { background: #94a3b8; }

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 780;
    white-space: nowrap;
}

.pill.good { color: #047857; background: #dff8eb; }
.pill.info { color: #1d4ed8; background: #e3efff; }
.pill.warn { color: #92400e; background: #fff1cc; }
.pill.bad { color: #be123c; background: #ffe4e9; }
.pill.neutral { color: #475569; background: #eef2f7; }

.money {
    font-weight: 800;
    white-space: nowrap;
}

.flash {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.flash.success { color: #047857; background: #ecfdf5; border-color: #bbf7d0; }
.flash.danger { color: #be123c; background: #fff1f2; border-color: #fecdd3; }
.flash.warning { color: #92400e; background: #fffbeb; border-color: #fde68a; }

.search-bar {
    display: grid;
    grid-template-columns: 1fr 220px auto;
    gap: 10px;
}

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

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-weight: 720;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.primary-button,
.secondary-button,
.ghost-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-weight: 780;
    cursor: pointer;
}

.primary-button {
    color: #fff;
    background: var(--blue);
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.2);
}

.secondary-button,
.ghost-button {
    color: #334155;
    background: linear-gradient(180deg, #fff, #f8fbff);
    border-color: #d7e3f0;
}

.ghost-button {
    min-height: 36px;
}

.primary-button:hover { background: #1d4ed8; }
.secondary-button:hover,
.ghost-button:hover { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }

.full {
    width: 100%;
}

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

.vehicle-card {
    display: grid;
    gap: 13px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,251,255,0.92));
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.vehicle-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.plate {
    display: inline-flex;
    align-items: center;
    width: max-content;
    min-height: 32px;
    padding: 5px 10px;
    border-radius: 6px;
    color: #0f172a;
    background: #eaf3ff;
    border: 1px solid #bfdbfe;
    font-weight: 850;
    letter-spacing: 0.02em;
}

.plate.big {
    min-height: 40px;
    font-size: 1.1rem;
}

dl {
    display: grid;
    gap: 8px;
    margin: 0;
}

dl div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #edf4fb;
}

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

dd {
    margin: 0;
    font-weight: 740;
    text-align: right;
}

.vehicle-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.vehicle-hero h2 {
    margin: 12px 0 4px;
    font-size: 1.5rem;
}

.hero-stats {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.hero-stats strong {
    font-size: 1.7rem;
}

.action-strip {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.action-strip a {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    font-weight: 760;
}

.operation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.operation-card {
    display: grid;
    gap: 6px;
    min-height: 94px;
    align-content: center;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: linear-gradient(180deg, #fff, #f8fbff);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.055);
}

.operation-card span {
    color: var(--muted);
}

.operation-card.active {
    border-color: #bfdbfe;
    background: linear-gradient(180deg, #eff6ff, #f8fbff);
}

.form-panel {
    max-width: 1040px;
}

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

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

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

.wide,
.form-actions,
.info-box {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}

.info-box {
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    color: #1e40af;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
}

.check-row input {
    width: 18px;
    min-height: 18px;
}

.user-admin-grid {
    align-items: start;
    margin-bottom: 16px;
}

.profile-row {
    align-items: flex-start;
}

.actions-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.small-button {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.9rem;
}

.responsive-table {
    overflow-x: auto;
    border: 1px solid #dbe8f6;
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid #edf4fb;
    text-align: left;
    vertical-align: top;
}

th {
    color: #64748b;
    font-size: 0.82rem;
    text-transform: uppercase;
    background: linear-gradient(180deg, #f4f9ff, #edf6ff);
}

tr:nth-child(even) td {
    background: #f8fbff;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.14);
}

.login-copy,
.login-card {
    padding: 44px;
}

.login-copy {
    display: grid;
    align-content: center;
    gap: 14px;
    background: linear-gradient(135deg, #eef6ff, #ecfdf5 60%, #fff8e7);
}

.login-copy h1 {
    margin: 0;
    font-size: 2.2rem;
}

.login-card {
    display: grid;
    align-content: center;
}

.login-card.standalone {
    width: min(520px, 100%);
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #eef2f7;
}

@media (max-width: 1050px) {
    .quick-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .user-box {
        width: 100%;
        padding-left: 0;
    }
}

@media (max-width: 780px) {
    .page {
        padding: 14px;
    }

    .page-title {
        margin: -14px -14px 16px;
        padding: 18px 14px;
    }

    .quick-grid,
    .two-columns,
    .three-columns,
    .form-grid,
    .login-panel,
    .search-bar {
        grid-template-columns: 1fr;
    }

    .vehicle-hero,
    .list-row,
    .status-list a {
        align-items: flex-start;
        flex-direction: column;
    }

    .hero-stats {
        justify-items: start;
    }

    .topbar {
        padding: 10px 14px;
    }

    .main-nav {
        width: 100%;
    }

    .nav-link {
        flex: 1 1 130px;
        justify-content: center;
    }

    .login-copy,
    .login-card {
        padding: 28px;
    }
}
