:root {
    --navy: #101828;
    --navy-soft: #1d2939;
    --brand: #3457d5;
    --brand-dark: #2744ad;
    --surface: #ffffff;
    --canvas: #f4f6fa;
    --line: #e5e9f2;
    --muted: #667085;
    --danger: #d92d20;
    --orange: #f79009;
    --yellow: #fdb022;
    --green: #12b76a;
    --ease-out: cubic-bezier(.22, 1, .36, 1);
}

@keyframes reveal-up {
    from { opacity: 0; transform: translateY(14px) scale(.992); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes metric-pop {
    0% { transform: scale(.96); }
    65% { transform: scale(1.035); }
    100% { transform: scale(1); }
}
@keyframes status-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217, 45, 32, .2); }
    50% { box-shadow: 0 0 0 5px rgba(217, 45, 32, 0); }
}
@keyframes bell-ring {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(12deg); }
    40% { transform: rotate(-10deg); }
    60% { transform: rotate(7deg); }
    80% { transform: rotate(-4deg); }
}
@keyframes orbit-drift {
    from { transform: translate3d(0, 0, 0) rotate(0); }
    to { transform: translate3d(18px, -12px, 0) rotate(8deg); }
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--canvas);
    color: var(--navy);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: .94rem;
}
a { color: var(--brand); }
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    width: 264px;
    background: var(--navy);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform .25s ease;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 22px 18px;
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 750;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(145deg, #5c7cfa, #3457d5);
    box-shadow: 0 8px 20px rgba(52, 87, 213, .35);
    transition: transform .3s var(--ease-out), box-shadow .3s ease;
}
.brand:hover .brand-mark { transform: translateY(-2px) rotate(-4deg); box-shadow: 0 11px 24px rgba(52, 87, 213, .45); }
.nav-section-label {
    padding: 18px 22px 8px;
    color: #98a2b3;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.sidebar .nav { padding: 0 12px; gap: 3px; }
.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 9px;
    color: #cbd5e1;
    font-weight: 550;
    transition: background .15s, color .15s, transform .2s var(--ease-out);
}
.sidebar .nav-link i { width: 20px; text-align: center; font-size: 1.03rem; transition: transform .2s var(--ease-out); }
.sidebar .nav-link:hover, .sidebar .nav-link.active { color: #fff; background: rgba(255, 255, 255, .1); }
.sidebar .nav-link.active { box-shadow: inset 3px 0 0 #7c9cff; }
.sidebar .nav-link:hover { transform: translateX(2px); }
.sidebar .nav-link:hover i { transform: translateX(2px) scale(1.05); }
.sidebar-user { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #344054;
    color: #fff;
    font-weight: 700;
}
.main { margin-left: 264px; min-height: 100vh; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    min-height: 66px;
    padding: 0 28px;
    background: rgba(255,255,255,.93);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-action {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 1.08rem;
}
.content { padding: 28px; max-width: 1680px; margin: 0 auto; }
.motion-ready .reveal-item { opacity: 0; transform: translateY(14px) scale(.992); }
.motion-ready.motion-active .reveal-item {
    animation: reveal-up .52s var(--ease-out) forwards;
    animation-delay: var(--reveal-delay, 0ms);
}
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-heading h1 { margin: 0 0 5px; font-size: clamp(1.55rem, 3vw, 2rem); font-weight: 760; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); }
.breadcrumb { margin: 0; font-size: .84rem; }
.card {
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
    transition: transform .24s var(--ease-out), box-shadow .24s ease, border-color .24s ease;
}
.card:hover { transform: translateY(-2px); border-color: #d7dce5; box-shadow: 0 10px 25px rgba(16, 24, 40, .08); }
.card-header { background: #fff; border-bottom-color: var(--line); padding: 17px 20px; border-radius: 14px 14px 0 0 !important; }
.card-body { padding: 20px; }
.metric-card { position: relative; isolation: isolate; height: 100%; overflow: hidden; }
.metric-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 100% 0, rgba(52, 87, 213, .11), transparent 48%);
    opacity: 0;
    transform: translate3d(12px, -8px, 0);
    transition: opacity .28s ease, transform .35s var(--ease-out);
}
.metric-card:hover::after { opacity: 1; transform: translate3d(0, 0, 0); }
.metric-card .card-body { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.metric-label { color: var(--muted); font-size: .83rem; font-weight: 650; }
.metric-value { margin-top: 8px; font-size: 1.75rem; line-height: 1; font-weight: 780; letter-spacing: -.04em; transform-origin: left center; }
.metric-value.is-counted { animation: metric-pop .38s var(--ease-out); }
.metric-icon {
    display: grid;
    place-items: center;
    min-width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #eef2ff;
    color: var(--brand);
    font-size: 1.15rem;
    transition: transform .28s var(--ease-out), background-color .28s ease;
}
.metric-card:hover .metric-icon { transform: translateY(-3px) rotate(-3deg) scale(1.06); background: #e9efff; }
.metric-icon.danger { background: #fef3f2; color: var(--danger); }
.metric-icon.warning { background: #fffaeb; color: var(--orange); }
.btn {
    border-radius: 9px;
    font-weight: 650;
    transition: transform .18s var(--ease-out), box-shadow .18s ease, color .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); }
.btn-light { border-color: var(--line); background: #fff; }
.form-control, .form-select {
    min-height: 42px;
    border-color: #d0d5dd;
    border-radius: 9px;
}
.form-control:focus, .form-select:focus { border-color: #8098ed; box-shadow: 0 0 0 .2rem rgba(52,87,213,.12); }
.form-label { font-weight: 650; color: #344054; }
.table { --bs-table-bg: transparent; margin: 0; }
.table th {
    padding: 12px 16px;
    border-bottom-width: 1px;
    background: #f9fafb;
    color: #667085;
    font-size: .73rem;
    font-weight: 760;
    letter-spacing: .035em;
    text-transform: uppercase;
    white-space: nowrap;
}
.table td { padding: 14px 16px; border-color: #eef0f4; vertical-align: middle; }
.table > tbody > tr { transition: background-color .18s ease, box-shadow .18s ease, transform .18s var(--ease-out); }
.table > tbody > tr:hover { background: #fafbff; box-shadow: inset 3px 0 0 rgba(52, 87, 213, .42); transform: translateX(2px); }
.vehicle-name { color: var(--navy); font-weight: 720; text-decoration: none; }
.registration { display: inline-flex; padding: 3px 8px; background: #f2f4f7; border: 1px solid #d0d5dd; border-radius: 5px; color: #344054; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; font-weight: 700; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.badge-soft { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; background: #f2f4f7; color: #475467; font-size: .75rem; font-weight: 700; }
.badge-soft.active, .badge-soft.safe { background: #ecfdf3; color: #027a48; }
.badge-soft.in_service, .badge-soft.warning { background: #fffaeb; color: #b54708; }
.badge-soft.overdue { background: #fef3f2; color: #b42318; }
.badge-soft.urgent { background: #fff4ed; color: #c4320a; }
.badge-soft.urgent .status-dot,
.badge-soft.overdue .status-dot,
.badge-soft.expired .status-dot { animation: status-pulse 1.8s ease-out infinite; }
.alert-strip {
    border-left: 4px solid var(--green);
    transition: transform .2s var(--ease-out), box-shadow .2s ease;
}
.alert-strip:hover { transform: translateX(3px); box-shadow: 0 7px 18px rgba(16, 24, 40, .06); }
.alert-strip.warning { border-left-color: var(--yellow); }
.alert-strip.urgent { border-left-color: var(--orange); }
.alert-strip.overdue { border-left-color: var(--danger); }
.list-compact .list-group-item { padding: 14px 0; border-color: #eef0f4; }
.timeline { position: relative; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: 14px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding: 0 0 24px 18px; transition: transform .2s var(--ease-out); }
.timeline-item:hover { transform: translateX(3px); }
.timeline-icon {
    position: absolute;
    left: -34px;
    top: 0;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #e9efff;
    color: var(--brand);
    font-size: .78rem;
    box-shadow: 0 0 0 1px var(--line);
}
.vehicle-cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 12px; background: #eef1f6; }
.vehicle-placeholder { display: grid; place-items: center; color: #98a2b3; font-size: 3.2rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px 22px; }
.detail-label { color: var(--muted); font-size: .78rem; }
.detail-value { margin-top: 3px; font-weight: 650; overflow-wrap: anywhere; }
.empty-state { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-state i { display: block; margin-bottom: 12px; font-size: 2rem; color: #98a2b3; }
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 480px) 1fr;
    background: #fff;
}
.login-panel { display: flex; align-items: center; padding: clamp(28px, 6vw, 76px); }
.login-panel-inner { width: 100%; max-width: 380px; margin: auto; }
.login-visual {
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    margin: 18px;
    padding: 60px;
    border-radius: 24px;
    background:
      radial-gradient(circle at 72% 25%, rgba(128,152,237,.45), transparent 25%),
      linear-gradient(145deg, #101828 0%, #1f3578 62%, #3457d5 100%);
    color: #fff;
}
.login-visual::before, .login-visual::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 50%;
    animation: orbit-drift 10s ease-in-out infinite alternate;
}
.login-visual::before { width: 440px; height: 440px; right: -100px; top: -90px; }
.login-visual::after {
    width: 280px;
    height: 280px;
    right: -20px;
    top: -10px;
    animation-duration: 13s;
    animation-direction: alternate-reverse;
}
.notification-bell i {
    display: inline-block;
    transform-origin: 50% 10%;
    animation: bell-ring .72s ease-in-out .8s both;
}
.mobile-menu { display: none; }
.pagination .page-link { color: var(--brand); border-color: var(--line); }
.pagination .active .page-link { background: var(--brand); border-color: var(--brand); }
.two-factor-code {
    font-variant-numeric: tabular-nums;
    letter-spacing: .22em;
    text-align: center;
    font-weight: 780;
}
.vehicle-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.vehicle-choice { position: relative; display: block; min-width: 0; }
.vehicle-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.vehicle-choice-body {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 16px;
    height: 100%;
    min-height: 180px;
    padding: 16px;
    overflow: hidden;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: #fff;
    transition: border-color .18s, background-color .18s, box-shadow .18s, transform .18s var(--ease-out);
}
label.vehicle-choice-body { cursor: pointer; }
.vehicle-choice.is-available:hover .vehicle-choice-body { transform: translateY(-2px); border-color: #9eb0ed; box-shadow: 0 9px 24px rgba(16,24,40,.09); }
.vehicle-choice input:focus-visible + .vehicle-choice-body { outline: 3px solid rgba(52,87,213,.24); outline-offset: 3px; }
.vehicle-choice input:checked + .vehicle-choice-body { border-color: var(--brand); background: #f4f6ff; box-shadow: 0 0 0 3px rgba(52,87,213,.14); }
.vehicle-choice-photo { display: grid; place-items: center; width: 108px; height: 100%; min-height: 144px; overflow: hidden; border-radius: 11px; background: #eef2ff; color: var(--brand); font-size: 2.3rem; }
.vehicle-choice-photo img { width: 100%; height: 100%; object-fit: cover; }
.vehicle-choice-content { display: block; min-width: 0; }
.vehicle-choice-name { display: block; color: var(--navy); font-size: 1.05rem; overflow-wrap: anywhere; }
.vehicle-choice-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 16px; color: var(--muted); font-size: .82rem; }
.vehicle-choice-meta span { display: inline-flex; align-items: center; gap: 6px; }
.vehicle-radio-visual { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; border: 2px solid #98a2b3; border-radius: 50%; background: #fff; color: transparent; font-size: 1rem; transition: all .18s ease; }
.vehicle-choice input:checked + .vehicle-choice-body .vehicle-radio-visual { border-color: var(--brand); background: var(--brand); color: #fff; transform: scale(1.06); }
.vehicle-choice.is-occupied .vehicle-choice-body { border-color: #e4e7ec; background: #f8fafc; color: #667085; opacity: .82; cursor: not-allowed; }
.vehicle-choice.is-occupied .vehicle-choice-photo { filter: grayscale(1); background: #eaecf0; color: #98a2b3; }
.vehicle-section-divider { height: 1px; margin: 26px 0; background: var(--line); }
.unavailable-vehicles summary { min-height: 48px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f9fafb; color: #475467; font-weight: 700; cursor: pointer; }
.vehicle-unavailable-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #f9fafb; }
.trip-step { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 9px; border-radius: 9px; background: #eef2ff; color: var(--brand); font-size: .8rem; font-weight: 800; }
.trip-submit-section { align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.selected-vehicle-summary { border-color: #c7d2f5; background: linear-gradient(135deg, #fff, #f5f7ff); }
.selected-vehicle-empty { display: grid; place-items: center; min-height: 190px; color: var(--muted); text-align: center; }
.selected-vehicle-empty i { margin-bottom: 12px; color: #98a2b3; font-size: 2rem; }
.selected-vehicle-details { display: grid; grid-template-columns: 124px minmax(0, 1fr); align-items: center; gap: 18px; }
.selected-vehicle-photo { display: grid; place-items: center; width: 124px; height: 124px; overflow: hidden; border-radius: 14px; background: #e9efff; color: var(--brand); font-size: 2.5rem; }
.selected-vehicle-photo img { width: 100%; height: 100%; object-fit: cover; }
.selected-vehicle-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: .85rem; }
.trip-end-summary .card-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.trip-summary-icon, .trip-state-icon { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 16px; background: #eef2ff; color: var(--brand); font-size: 1.7rem; }
.trip-state-icon { margin-bottom: 18px; }
.trip-state-icon.warning { background: #fff4ed; color: #c4320a; }
.trip-state-icon.success { background: #ecfdf3; color: #027a48; }
.trip-end-details { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.distance-preview-card { border-color: #b8c5ef; background: linear-gradient(135deg, #fff, #f3f6ff); }
.distance-preview-value { margin-bottom: 12px; color: var(--navy); font-size: clamp(2.5rem, 7vw, 4rem); line-height: 1; font-weight: 800; letter-spacing: -.05em; }
.distance-preview-value small { color: var(--muted); font-size: 1.1rem; letter-spacing: 0; }
.confirmation-card { border-color: #98dcb8; background: #f2fff8; }
.confirmation-check { display: flex; align-items: flex-start; gap: 12px; min-height: 56px; margin: 0; }
.confirmation-check .form-check-input { flex: 0 0 auto; width: 26px; height: 26px; margin: 0; }
.confirmation-check .form-check-label { display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.confirmation-check .form-check-label span { color: var(--muted); font-size: .86rem; }
.confirmation-check .invalid-feedback { width: 100%; margin-left: 38px; }
.trip-step-heading { margin-bottom: 18px; outline: none; }
.trip-step-heading:focus-visible, .trip-signature-header:focus-visible { border-radius: 8px; box-shadow: 0 0 0 .2rem rgba(52,87,213,.18); }
.trip-step-progress { display: inline-flex; margin-bottom: 7px; color: var(--brand); font-size: .78rem; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.trip-signature-step {
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
.trip-signature-shell {
    display: grid;
    grid-template-rows: auto minmax(220px, 1fr) auto;
    gap: 12px;
    max-width: 1120px;
    min-height: 480px;
    height: min(760px, calc(100vh - 120px));
    margin: 0 auto;
    padding: 24px;
    border: 1px solid #c7d2f5;
    border-radius: 18px;
    background: #f8faff;
    box-shadow: 0 18px 48px rgba(16, 24, 40, .11);
}
.trip-signature-header { margin-bottom: 18px; outline: none; }
.trip-signature-header h2 { margin: 0 0 5px; font-size: clamp(1.55rem, 4vw, 2.15rem); font-weight: 780; letter-spacing: -.035em; }
.trip-signature-header p { margin: 0; color: var(--muted); }
.trip-signature-route-confirmation { margin-top: 10px; padding: 8px 10px; border: 1px solid #d0d8ec; border-radius: 9px; background: #fff; font-size: .86rem; line-height: 1.35; }
.trip-signature-canvas-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.signature-canvas-wrap {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 220px;
    max-height: 420px;
    aspect-ratio: 3 / 1;
    margin: auto;
    overflow: hidden;
    border: 2px solid #98a2b3;
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 1px 3px rgba(16, 24, 40, .08);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior: contain;
}
.signature-canvas-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(52,87,213,.12); }
.signature-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: #fff;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior: contain;
    outline: none;
}
.signature-baseline {
    position: absolute;
    right: 5%;
    bottom: 7px;
    left: 5%;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    height: 34px;
    border-top: 1px solid #98a2b3;
    color: #667085;
    font-size: .68rem;
    line-height: 1;
    pointer-events: none;
}
.signature-baseline span { margin-top: 6px; padding: 0 5px; background: rgba(255,255,255,.9); }
.signature-debug-point {
    position: absolute;
    z-index: 4;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #d92d20;
    box-shadow: 0 0 0 1px #d92d20;
    pointer-events: none;
}
.signature-canvas-wrap canvas:focus-visible { box-shadow: inset 0 0 0 3px rgba(52,87,213,.26); }
.signature-canvas-wrap.is-drawing { border-color: var(--brand); }
.signature-canvas-wrap.has-signature { border-color: var(--green); }
.signature-error { display: block; min-height: 24px; margin-top: 9px; font-size: .84rem; }
.signature-error[hidden] { display: block !important; visibility: hidden; }
.trip-signature-actions { display: grid; grid-template-columns: auto auto minmax(260px, 1fr); gap: 12px; margin-top: 14px; }
.trip-signature-actions .btn { min-height: 48px; }
.trip-signature-actions [data-trip-complete-button] { justify-self: end; width: 100%; max-width: 430px; }
.signature-preview {
    display: grid;
    place-items: center;
    min-height: 180px;
    padding: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}
.signature-preview img { display: block; width: 100%; max-height: 220px; object-fit: contain; }
.signature-confirmation-card { border-color: #98dcb8; }
.signature-integrity-failed { border-color: #f97066; background: #fffafa; }
.correction-history-card { border-color: #fdb022; background: #fffcf5; }
.grid-column-full { grid-column: 1 / -1; }
.trip-sticky-actions, .trip-primary-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
.trip-primary-actions .btn { min-height: 52px; }
.trip-status-active { background: #fff4ed; color: #c4320a; }
.trip-status-completed { background: #eff8ff; color: #175cd3; }
.trip-status-approved { background: #ecfdf3; color: #027a48; }
.trip-status-rejected { background: #fef3f2; color: #b42318; }
.trip-status-cancelled { background: #f2f4f7; color: #475467; }
.app-update-banner {
    position: fixed;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: min(520px, calc(100vw - 36px));
    padding: 13px 14px;
    border: 1px solid #9eb0ed;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(16, 24, 40, .2);
}
.app-update-banner[hidden] { display: none !important; }
.app-update-banner .btn { min-height: 48px; white-space: nowrap; }
.app-reload-dialog {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: grid;
    place-items: center;
    padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
    background: rgba(16, 24, 40, .58);
}
.app-reload-dialog[hidden] { display: none !important; }
.app-reload-dialog-panel {
    width: min(100%, 480px);
    padding: 24px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(16, 24, 40, .3);
}
.app-reload-dialog-panel h2 { margin: 0 0 10px; font-size: 1.28rem; }
.app-reload-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.app-reload-dialog-actions .btn { min-height: 48px; }
body.app-dialog-open { overflow: hidden; }
.current-trip-card { border-color: #fdb022; background: linear-gradient(135deg, #fff, #fffaeb); }
.dashboard-trip-action {
    position: relative;
    overflow: hidden;
    border-width: 1px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .09);
}
.dashboard-trip-action::after {
    content: "";
    position: absolute;
    top: -120px;
    right: -90px;
    width: 290px;
    height: 290px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .38);
    pointer-events: none;
}
.dashboard-trip-action.is-ready {
    border-color: #b8c5ef;
    background: linear-gradient(135deg, #f8faff 0%, #eef2ff 62%, #e8edff 100%);
}
.dashboard-trip-action.is-active {
    border-color: #fdb022;
    background: linear-gradient(135deg, #fff 0%, #fffaeb 62%, #fff4d6 100%);
}
.dashboard-trip-action .card-body { padding: clamp(22px, 3vw, 34px); }
.dashboard-trip-action-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(18px, 3vw, 30px);
    min-width: 0;
}
.dashboard-trip-action-icon {
    display: grid;
    place-items: center;
    width: clamp(66px, 7vw, 88px);
    height: clamp(66px, 7vw, 88px);
    border-radius: 22px;
    background: #fff;
    color: var(--brand);
    font-size: clamp(2rem, 4vw, 2.8rem);
    box-shadow: 0 10px 24px rgba(52, 87, 213, .14);
}
.dashboard-trip-action.is-active .dashboard-trip-action-icon { color: #b54708; box-shadow: 0 10px 24px rgba(181, 71, 8, .12); }
.dashboard-trip-action-content { min-width: 0; }
.dashboard-trip-action-title { margin: 0; color: var(--navy); font-size: clamp(1.55rem, 3vw, 2.25rem); font-weight: 790; letter-spacing: -.035em; }
.dashboard-trip-action-copy { max-width: 640px; margin: 8px 0 0; color: #475467; font-size: 1rem; }
.dashboard-trip-vehicle { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 7px 0 0; color: #344054; font-size: 1.08rem; font-weight: 730; }
.dashboard-trip-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 22px;
    margin: 22px 0 0;
}
.dashboard-trip-details div { min-width: 0; }
.dashboard-trip-details dt { color: var(--muted); font-size: .75rem; font-weight: 720; }
.dashboard-trip-details dd { margin: 3px 0 0; color: #344054; font-weight: 670; overflow-wrap: anywhere; }
.dashboard-trip-actions { display: flex; flex-direction: column; gap: 10px; min-width: 220px; }
.dashboard-trip-actions .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; white-space: nowrap; }
.dashboard-trip-actions .dashboard-trip-cta { min-height: 56px; padding-inline: 24px; font-size: 1.05rem; }
.preserve-lines { white-space: pre-wrap; }
.trip-form, .trip-form .row, .trip-form [class*="col-"] { min-width: 0; }
.vehicle-form .form-label { font-weight: 680; }
.vehicle-form .form-control, .vehicle-form .form-select { min-height: 44px; }
.vehicle-related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.vehicle-related-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: #fff; transition: border-color .2s ease, box-shadow .2s ease; }
.vehicle-related-card[open] { grid-column: 1 / -1; border-color: #b8c5ef; box-shadow: 0 10px 24px rgba(52, 87, 213, .08); }
.vehicle-related-card summary { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 13px; min-height: 76px; padding: 13px 16px; cursor: pointer; list-style: none; user-select: none; }
.vehicle-related-card summary::-webkit-details-marker { display: none; }
.vehicle-related-card summary:focus-visible { outline: 3px solid rgba(52, 87, 213, .24); outline-offset: -3px; }
.vehicle-related-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; background: #eef2ff; color: var(--brand); font-size: 1.3rem; }
.vehicle-related-title { min-width: 0; }
.vehicle-related-title strong, .vehicle-related-title small { display: block; overflow-wrap: anywhere; }
.vehicle-related-title small { margin-top: 3px; color: var(--muted); font-size: .78rem; }
.vehicle-related-chevron { color: var(--muted); transition: transform .2s ease; }
.vehicle-related-card[open] .vehicle-related-chevron { transform: rotate(180deg); }
.vehicle-related-fields { padding: 4px 18px 20px; border-top: 1px solid var(--line); }
.vehicle-related-fields fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.vehicle-related-enable { display: flex; align-items: flex-start; gap: 11px; min-height: 56px; margin: 14px 0; padding: 12px 14px; border: 1px solid #d7deef; border-radius: 11px; background: #f8faff; cursor: pointer; }
.vehicle-related-enable .form-check-input { flex: 0 0 auto; width: 1.25rem; height: 1.25rem; margin-top: 2px; }
.vehicle-related-enable span, .vehicle-related-enable strong, .vehicle-related-enable small { display: block; }
.vehicle-related-enable small { margin-top: 2px; color: var(--muted); }
.vehicle-related-card.is-enabled { border-color: #8fa4ee; }
.vehicle-related-card.is-enabled .vehicle-related-enable { border-color: #aebdf0; background: #eef2ff; }
.current-related-record { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; margin: 14px 0; padding: 12px 14px; border-radius: 10px; background: #f8faff; color: #475467; font-size: .84rem; }
.current-related-record strong { color: var(--navy); }
.current-related-record .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
.oil-filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.oil-filter-choice { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.oil-filter-choice .form-check-input { flex: 0 0 auto; width: 22px; height: 22px; margin: 0; }
.vehicle-form-actions .btn { min-height: 48px; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: 12px 0 32px rgba(16,24,40,.18); }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 1030;
        background: rgba(16,24,40,.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s ease;
    }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open::after { opacity: 1; pointer-events: auto; }
    .sidebar { z-index: 1040; }
    .main { margin-left: 0; }
    .mobile-menu { display: inline-flex; }
    .topbar { padding: 0 16px; }
    .content { padding: 20px 16px; }
    .login-page { grid-template-columns: 1fr; }
    .login-visual { display: none; }
    .dashboard-trip-action-layout { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
    .dashboard-trip-actions { grid-column: 1 / -1; flex-direction: row; min-width: 0; }
    .dashboard-trip-actions .btn { flex: 1 1 0; }
    .trip-end-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vehicle-related-grid { grid-template-columns: 1fr; }
    .vehicle-related-card[open] { grid-column: auto; }
    body.trip-signature-step-open { overflow: hidden; }
    .trip-signature-step {
        position: fixed;
        inset: 0;
        z-index: 1060;
        overflow: hidden;
        padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
        background: #f4f6fa;
        overscroll-behavior: none;
    }
    .trip-signature-shell {
        width: 100%;
        max-width: none;
        min-height: 0;
        height: 100%;
        padding: 8px;
        border: 0;
        border-radius: 12px;
        box-shadow: none;
        overflow: hidden;
    }
    .trip-signature-header {
        display: grid;
        grid-template-columns: auto auto minmax(0, 1fr);
        align-items: center;
        gap: 8px 12px;
        margin: 0;
    }
    .trip-signature-header .trip-step-progress { margin: 0; white-space: nowrap; }
    .trip-signature-header h2 { margin: 0; font-size: 1.3rem; white-space: nowrap; }
    .trip-signature-header p { overflow: hidden; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
    .trip-signature-header .trip-signature-route-confirmation { grid-column: 1 / -1; margin-top: 0; padding: 5px 8px; font-size: .76rem; line-height: 1.25; }
    .signature-canvas-wrap { width: 100%; height: 100%; min-height: min(220px, calc(100dvh - 150px)); max-height: 420px; aspect-ratio: auto; }
    .trip-signature-actions { grid-template-columns: auto auto minmax(260px, 1fr); gap: 8px; margin: 0; }
    .trip-signature-actions .btn { min-height: 48px; padding-top: 8px; padding-bottom: 8px; }
    .trip-signature-actions [data-trip-complete-button] { max-width: none; }
    .trip-signature-step.is-auto-rotated { padding: 0; }
    .trip-signature-step.is-auto-rotated .trip-signature-shell {
        position: absolute;
        top: 50%;
        left: 50%;
        width: var(--signature-panel-width, 100dvh);
        height: var(--signature-panel-height, 100dvw);
        padding: max(8px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-top));
        border-radius: 0;
        transform: translate(-50%, -50%) rotate(90deg);
        transform-origin: center;
    }
}
@media (max-width: 575.98px) {
    .page-heading { flex-direction: column; }
    .page-heading .btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; }
    .detail-grid { grid-template-columns: 1fr; }
    .card-body { padding: 16px; }
    .table td, .table th { padding-left: 12px; padding-right: 12px; }
    .vehicle-choice-grid { grid-template-columns: 1fr; }
    .vehicle-choice-body { grid-template-columns: 88px minmax(0, 1fr); min-height: 156px; padding: 14px; }
    .vehicle-choice-photo { width: 88px; min-height: 126px; }
    .vehicle-choice-meta { flex-direction: column; gap: 5px; margin-top: 12px; }
    .selected-vehicle-details { grid-template-columns: 82px minmax(0, 1fr); gap: 14px; }
    .selected-vehicle-photo { width: 82px; height: 82px; }
    .trip-end-details { grid-template-columns: 1fr; }
    .trip-signature-actions { grid-template-columns: 1fr 1fr; }
    .trip-signature-actions .btn { width: 100%; min-height: 50px; }
    .trip-signature-actions [data-trip-complete-button] { grid-column: 1 / -1; grid-row: 2; max-width: none; min-height: 56px; }
    .trip-signature-step.is-auto-rotated .trip-signature-actions { grid-template-columns: auto auto minmax(240px, 1fr); }
    .trip-signature-step.is-auto-rotated .trip-signature-actions .btn { width: auto; min-height: 48px; }
    .trip-signature-step.is-auto-rotated .trip-signature-actions [data-trip-complete-button] { grid-column: auto; grid-row: auto; width: 100%; min-height: 48px; }
    .app-update-banner { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; flex-direction: column; align-items: stretch; max-width: none; }
    .app-update-banner .btn { width: 100%; }
    .app-reload-dialog-panel { padding: 20px; }
    .app-reload-dialog-actions { flex-direction: column-reverse; }
    .app-reload-dialog-actions .btn { width: 100%; }
    .dashboard-trip-action .card-body { padding: 20px; }
    .dashboard-trip-action-layout { grid-template-columns: 1fr; gap: 16px; }
    .dashboard-trip-action-icon { width: 64px; height: 64px; border-radius: 18px; font-size: 2rem; }
    .dashboard-trip-details { grid-template-columns: 1fr; gap: 12px; margin-top: 18px; }
    .dashboard-trip-actions { grid-column: auto; flex-direction: column; width: 100%; }
    .dashboard-trip-actions .btn { flex-basis: auto; width: 100%; min-height: 52px; white-space: normal; }
    .dashboard-trip-actions .dashboard-trip-cta { min-height: 56px; }
    .trip-sticky-actions {
        position: sticky;
        z-index: 1010;
        bottom: 0;
        margin: 0 -16px -20px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: rgba(255,255,255,.96);
        border-top: 1px solid var(--line);
        backdrop-filter: blur(10px);
    }
    .trip-sticky-actions .btn, .trip-primary-actions .btn { flex: 1 1 100%; min-height: 54px; }
    .trip-sticky-actions .me-auto { flex: 1 1 100%; }
    .trip-table, .trip-table tbody, .trip-table tr, .trip-table td { display: block; width: 100%; }
    .trip-table thead { display: none; }
    .trip-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
    .trip-table td { display: flex; justify-content: space-between; gap: 18px; padding: 7px 0; border: 0; text-align: right !important; overflow-wrap: anywhere; }
    .trip-table td::before { content: attr(data-label); flex: 0 0 32%; color: var(--muted); font-size: .74rem; font-weight: 700; text-align: left; text-transform: uppercase; }
    .trip-table td:not([data-label]) { display: block; text-align: left !important; }
    .trip-table > tbody > tr:hover { transform: none; box-shadow: none; }
    .mobile-card-table, .mobile-card-table tbody, .mobile-card-table tr, .mobile-card-table td { display: block; width: 100%; }
    .mobile-card-table thead { display: none; }
    .mobile-card-table tbody { padding: 10px; }
    .mobile-card-table tr { margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
    .mobile-card-table td { display: flex; justify-content: space-between; gap: 18px; padding: 7px 0; border: 0; text-align: right !important; overflow-wrap: anywhere; }
    .mobile-card-table td::before { content: attr(data-label); flex: 0 0 34%; color: var(--muted); font-size: .72rem; font-weight: 720; text-align: left; text-transform: uppercase; }
    .mobile-card-table td[data-label="Samochód"] { display: block; padding-bottom: 12px; text-align: left !important; }
    .mobile-card-table td[data-label="Samochód"]::before { display: none; }
    .mobile-card-table td[data-label="Akcje"] { justify-content: flex-end; padding-top: 12px; }
    .mobile-card-table td[data-label="Akcje"]::before { display: none; }
    .mobile-card-table td[data-label="Akcje"] .btn { min-width: 48px; min-height: 48px; }
    .filters .col-auto { width: 100%; }
    .filters .col-auto .btn { width: 100%; min-height: 48px; }
    .vehicle-related-section .card-header { padding: 16px; }
    .vehicle-related-section .card-body { padding: 12px; }
    .vehicle-related-card summary { min-height: 72px; padding: 12px; }
    .vehicle-related-fields { padding: 4px 14px 18px; }
    .vehicle-related-enable { min-height: 56px; }
    .oil-filter-grid { grid-template-columns: 1fr; }
    .vehicle-form-actions { position: sticky; z-index: 1010; bottom: 0; flex-direction: column-reverse; margin: 0 -16px -20px !important; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(10px); }
    .vehicle-form-actions .btn { width: 100%; min-height: 54px; }
    .page-heading > .page-actions { width: 100%; flex-direction: column; }
    .card-header .nav-tabs { flex-wrap: wrap; gap: 4px; }
    .card-header .nav-tabs .nav-link { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        transition-delay: 0ms !important;
    }
    .motion-ready .reveal-item { opacity: 1; transform: none; }
}
@media print {
    .sidebar, .topbar, .page-actions, .filters, .btn { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
