:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #17212b;
    --muted: #637083;
    --line: #dbe2ea;
    --brand: #0d6efd;
    --brand-dark: #084eb4;
    --ok: #177245;
    --warn: #b76b00;
    --danger: #c93535;
    --soft-blue: #e8f1ff;
    --soft-red: #ffe9e9;
    --shadow: 0 12px 30px rgba(19, 34, 54, 0.08);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

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

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.auth-pending .app-shell {
    display: none;
}

.auth-gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    grid-template-rows: auto auto;
    align-content: center;
    gap: 16px;
    padding: 18px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
        linear-gradient(145deg, #07111c, #111d2b 56%, #070b11);
    background-size: 34px 34px, 34px 34px, auto;
}

.auth-gate[hidden] {
    display: none;
}

.auth-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 8, 14, 0.42);
    backdrop-filter: blur(14px);
}

.auth-card {
    position: relative;
    width: min(360px, 100%);
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 248, 252, 0.97));
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    animation: authModalEnter 0.28s ease both;
}

.auth-header {
    display: grid;
    gap: 4px;
    text-align: center;
    padding: 2px 4px 0;
}

.auth-floating-logo {
    position: relative;
    z-index: 1;
    width: min(210px, 62vw);
    max-height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.34));
}

.auth-card h1 {
    margin: 0;
    font-size: 1.34rem;
    line-height: 1.1;
}

.auth-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.4;
}

.auth-fields {
    display: grid;
    gap: 9px;
}

.auth-field {
    gap: 7px;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    color: #405063;
}

.auth-field span {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-field input {
    min-height: 34px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 1.02rem;
    color: var(--ink);
}

.auth-field input:focus {
    box-shadow: none;
}

.auth-field:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.12);
}

.auth-submit {
    min-height: 48px;
    border-radius: 14px;
    box-shadow: 0 12px 26px rgba(13, 110, 253, 0.26);
}

.auth-error {
    padding: 10px 12px;
    border: 1px solid #f3b5b5;
    border-radius: 12px;
    background: var(--soft-red);
    color: #8d1f1f;
    font-weight: 700;
    font-size: 0.9rem;
}

.auth-error[hidden] {
    display: none;
}

.auth-foot {
    padding-top: 2px;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
}

.link-button {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 800;
    text-decoration: underline;
    cursor: pointer;
}

.rgpd-notice {
    padding: 10px 12px;
    border: 1px solid #cbd7e6;
    border-radius: 12px;
    background: #f7fafc;
    color: #31445a;
}

@keyframes authModalEnter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: calc(14px + env(safe-area-inset-top)) 14px 12px;
    background:
        linear-gradient(135deg, rgba(23, 33, 43, 0.98), rgba(7, 15, 25, 0.98)),
        #101925;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 36px rgba(4, 12, 22, 0.24);
    backdrop-filter: blur(16px);
}

.brand-row {
    display: grid;
    justify-items: center;
    align-items: center;
    gap: 10px;
    max-width: 1160px;
    margin: 0 auto;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    min-width: 0;
    text-align: center;
}

.brand-mark {
    width: min(178px, 52vw);
    height: 48px;
    display: grid;
    place-items: center;
}

.brand-mark img {
    max-width: 100%;
    max-height: 48px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.28));
}

.protected-asset {
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    user-select: none;
    pointer-events: none;
}

.brand-copy {
    display: grid;
    gap: 2px;
}

.brand strong {
    font-size: 1.05rem;
    color: #fff;
}

.brand span {
    color: rgba(229, 237, 247, 0.74);
    font-size: 0.82rem;
}

.role-pill {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(235, 242, 250, 0.82);
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

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

main {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 14px 14px 92px;
}

.tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 28px rgba(28, 40, 58, 0.08);
}

.tab {
    min-height: 54px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    gap: 2px;
    font-size: 0.72rem;
}

.tab svg {
    width: 21px;
    height: 21px;
    stroke-width: 2;
}

.tab.active {
    background: var(--soft-blue);
    color: var(--brand-dark);
    font-weight: 700;
}

.tab:disabled {
    cursor: not-allowed;
    opacity: 0.42;
    color: #8a94a2;
    filter: grayscale(0.4);
}

.tab:disabled.active {
    background: transparent;
    color: #8a94a2;
    font-weight: 400;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.grid {
    display: grid;
    gap: 12px;
}

.two-cols {
    display: grid;
    gap: 12px;
}

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

.panel-body {
    padding: 14px;
}

.panel-title {
    margin: 0 0 10px;
    font-size: 1rem;
}

.qr-vehicle-notice {
    display: grid;
    gap: 2px;
    margin: 0 0 12px;
    padding: 11px 12px;
    border: 1px solid #b9d7ff;
    border-radius: var(--radius);
    background: var(--soft-blue);
    color: var(--brand-dark);
}

.qr-vehicle-notice[hidden] {
    display: none;
}

.qr-vehicle-notice strong {
    font-size: 0.95rem;
}

.qr-vehicle-notice span {
    font-size: 0.8rem;
    color: #315f96;
}

.section-title {
    margin: 18px 0 10px;
    font-size: 1.05rem;
}

.form-grid {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

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

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

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.14);
}

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

.button {
    min-height: 46px;
    border: 0;
    border-radius: var(--radius);
    padding: 0 14px;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.button.secondary {
    background: #eef2f6;
    color: var(--ink);
    border: 1px solid var(--line);
}

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

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

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

.diagram-wrap {
    display: grid;
    gap: 10px;
}

.view-switcher {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.view-button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    padding: 0 6px;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.view-button.active {
    background: var(--soft-blue);
    border-color: #9fc7ff;
    color: var(--brand-dark);
    transform: translateY(-1px);
}

.vehicle-diagram {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    overflow: hidden;
}

.bus-image-map {
    position: relative;
    width: 100%;
    aspect-ratio: var(--map-ratio, 16 / 9);
    background: #fff;
    overflow: hidden;
    animation: diagramEnter 0.24s ease both;
}

.bus-map-canvas {
    position: absolute;
    left: var(--map-left, 0);
    top: var(--map-top, 0);
    width: var(--map-width, 100%);
    transition: left 0.26s ease, top 0.26s ease, width 0.26s ease;
}

.bus-image-map img {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

@keyframes diagramEnter {
    from {
        opacity: 0;
        transform: scale(0.985);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.zone {
    fill: rgba(13, 110, 253, 0.08);
    stroke: rgba(55, 73, 96, 0.45);
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill 0.16s ease, stroke 0.16s ease, transform 0.16s ease;
}

.zone:hover,
.zone.selected {
    fill: rgba(13, 110, 253, 0.28);
    stroke: var(--brand);
}

.zone.has-damage {
    fill: rgba(201, 53, 53, 0.24);
    stroke: var(--danger);
}

.zone.has-damage.selected {
    fill: rgba(201, 53, 53, 0.36);
    stroke: #9d1f1f;
}

.zone-point {
    position: absolute;
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.28), 0 6px 14px rgba(13, 28, 48, 0.24);
    transform: translate(-50%, -50%);
    cursor: pointer;
}

.zone-point:hover,
.zone-point.selected {
    background: #063f91;
    box-shadow: 0 0 0 5px rgba(13, 110, 253, 0.22), 0 8px 18px rgba(13, 28, 48, 0.28);
}

.zone-point.has-damage {
    background: var(--danger);
    box-shadow: 0 0 0 5px rgba(201, 53, 53, 0.22), 0 8px 18px rgba(13, 28, 48, 0.26);
}

.zone-point.has-damage.selected {
    background: #9d1f1f;
}

.zone-point span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.zone-label {
    pointer-events: none;
    fill: var(--ink);
    font-size: 11px;
    font-weight: 800;
}

.zone-damage-panel {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.zone-damage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(248, 251, 252, 0.9);
}

.zone-damage-head strong {
    color: var(--ink);
}

.zone-damage-head span {
    color: var(--muted);
    font-size: 0.84rem;
    white-space: nowrap;
}

.zone-damage-list {
    display: grid;
    gap: 10px;
    max-height: min(460px, 52vh);
    overflow: auto;
    padding-right: 2px;
}

.zone-damage-list .damage-card {
    border-radius: 14px;
}

.compact-empty {
    padding: 12px;
    border-radius: 14px;
}

.bus-line {
    fill: none;
    stroke: #233142;
    stroke-width: 2.5;
    stroke-linejoin: round;
}

.bus-body {
    fill: #f7fbff;
    stroke: #263241;
    stroke-width: 2.5;
}

.bus-shadow {
    fill: rgba(26, 39, 55, 0.12);
}

.bus-glass {
    fill: #a9cee8;
    stroke: #31445a;
    stroke-width: 1.4;
}

.bus-detail {
    fill: #d9e4ee;
    stroke: #52667c;
    stroke-width: 1.2;
}

.hint {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--muted);
    background: #eef2f6;
}

.status.open {
    color: #962727;
    background: var(--soft-red);
}

.status.repaired {
    color: var(--ok);
    background: #e3f5ea;
}

.status.warning {
    color: var(--warn);
    background: #fff2d8;
}

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

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

.stat strong {
    display: block;
    font-size: 1.35rem;
}

.stat span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.cards {
    display: grid;
    gap: 10px;
}

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

.admin-title {
    margin: 0;
}

.admin-filters {
    margin-top: 12px;
}

.admin-module-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0 6px;
}

.admin-module-button {
    min-height: 82px;
    display: grid;
    align-content: space-between;
    gap: 8px;
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 248, 252, 0.94)),
        #fff;
    color: var(--ink);
    text-align: left;
    box-shadow: 0 16px 38px rgba(19, 34, 54, 0.09);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.admin-module-button.active {
    border-color: rgba(13, 110, 253, 0.34);
    background:
        linear-gradient(180deg, rgba(232, 241, 255, 0.98), rgba(255, 255, 255, 0.95)),
        var(--soft-blue);
    color: var(--brand-dark);
    box-shadow: 0 18px 44px rgba(13, 110, 253, 0.16);
}

.admin-module-button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    border-color: rgba(99, 112, 131, 0.22);
    background:
        linear-gradient(180deg, rgba(235, 239, 244, 0.86), rgba(225, 230, 236, 0.82)),
        #edf1f5;
    color: #7c8795;
    box-shadow: none;
    filter: grayscale(0.35);
}

.admin-module-button:disabled span {
    color: #8a94a2;
}

.admin-module-button:active {
    transform: scale(0.985);
}

.admin-module-button:disabled:active {
    transform: none;
}

.admin-module-button strong {
    display: block;
    font-size: 0.96rem;
}

.admin-module-button span {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.25;
}

.admin-module-button.active span {
    color: #315f9f;
}

.admin-module-panel[hidden] {
    display: none;
}

.form-row {
    margin-bottom: 0;
}

.module-list {
    margin-top: 10px;
}

#diagramAdminPreview .bus-image-map {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: grab;
    touch-action: none;
}

#diagramAdminPreview .bus-image-map:active {
    cursor: grabbing;
}

#diagramAdminPreview .zone-point {
    cursor: grab;
    touch-action: none;
}

#diagramAdminPreview .zone-point:active {
    cursor: grabbing;
}

.mileage-chart-card {
    display: grid;
    gap: 12px;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.mileage-chart {
    display: grid;
    gap: 10px;
}

.mileage-bar-row {
    display: grid;
    grid-template-columns: minmax(86px, 0.7fr) minmax(120px, 2fr) minmax(76px, auto);
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.82rem;
}

.mileage-bar-row strong {
    color: var(--ink);
    text-align: right;
}

.mileage-bar-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2f7;
}

.mileage-bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand), #52d6b5);
}

.recap-vehicle-block {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow);
}

.recap-vehicle-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.recap-vehicle-head strong,
.recap-vehicle-head span {
    display: block;
}

.recap-vehicle-head span,
.recap-count {
    color: var(--muted);
    font-size: 0.82rem;
}

.recap-count {
    flex: 0 0 auto;
    font-weight: 800;
    text-align: right;
}

.stat-widget {
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98)),
        #fff;
    padding: 14px;
    display: grid;
    gap: 10px;
    box-shadow: var(--shadow);
}

.stat-widget h3 {
    margin: 0;
    font-size: 0.95rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.86rem;
}

.stat-row strong {
    color: var(--ink);
}

.damage-card,
.vehicle-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 12px;
    display: grid;
    gap: 9px;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.card-head strong {
    display: block;
}

.meta {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.damage-text {
    margin: 0;
    line-height: 1.4;
}

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

.workshop-actions .button:disabled {
    display: none;
}

.workshop-progress {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.workshop-progress span {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border-radius: 999px;
    background: #eef2f6;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
}

.workshop-progress span.done {
    background: var(--soft-blue);
    color: var(--brand-dark);
}

.workshop-note {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fbfcfe;
}

.workshop-note strong {
    font-size: 0.82rem;
}

.workshop-note span {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.invoice-block {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fbfcfe;
}

.invoice-block strong {
    font-size: 0.82rem;
}

.invoice-file {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--brand-dark);
    font-weight: 800;
    text-decoration: none;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 92px);
    gap: 8px;
    align-items: start;
    justify-content: start;
}

.media-thumb,
.media-grid video {
    width: 92px;
    height: 92px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #eef2f6;
    overflow: hidden;
}

.media-thumb {
    position: relative;
    display: block;
    padding: 0;
    cursor: zoom-in;
}

.video-thumb {
    cursor: default;
}

.media-thumb img,
.media-grid video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-more {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.42);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 900;
    pointer-events: none;
}

.media-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(2, 8, 15, 0.92);
}

.privacy-modal {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(2, 8, 15, 0.78);
}

.privacy-modal[hidden] {
    display: none;
}

.privacy-card {
    position: relative;
    width: min(720px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 22px;
    border-radius: 18px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.privacy-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 38px;
    height: 38px;
    min-height: 38px;
    border: 1px solid #d6e0eb;
    border-radius: 50%;
    background: #f6f9fc;
    color: var(--ink);
    font-size: 1.35rem;
    line-height: 1;
}

.privacy-copy {
    display: grid;
    gap: 10px;
    color: #35485d;
    line-height: 1.55;
}

.privacy-copy h3 {
    margin: 10px 0 0;
    color: var(--ink);
    font-size: 1rem;
}

.privacy-copy p {
    margin: 0;
}

.audit-log-card pre {
    overflow: auto;
    max-height: 180px;
    margin: 10px 0 0;
    padding: 10px;
    border-radius: 10px;
    background: #f5f7fa;
    color: #26384d;
    font-size: 0.78rem;
    white-space: pre-wrap;
}

.media-lightbox[hidden] {
    display: none;
}

.media-lightbox img {
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    border-radius: var(--radius);
    object-fit: contain;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.media-lightbox-close {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top));
    right: 14px;
    z-index: 1201;
    width: 44px;
    height: 44px;
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.7rem;
    line-height: 1;
}

.lightbox-open {
    overflow: hidden;
}

.filter-bar {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.empty {
    padding: 18px;
    color: var(--muted);
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: #fbfcfe;
}

.admin-lock {
    display: grid;
    gap: 12px;
}

.toast {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 40;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: #132132;
    color: #fff;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.small-action {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.82rem;
}

.split-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.role-access-list,
.role-access-grid,
.qr-grid {
    display: grid;
    gap: 10px;
}

.role-access-card,
.qr-card {
    display: grid;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

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

.role-module-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
    color: var(--ink);
    font-size: 0.88rem;
}

.role-module-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.qr-grid {
    grid-template-columns: 1fr;
}

.qr-card {
    align-content: start;
}

.qr-preview {
    position: relative;
    justify-self: center;
    width: min(180px, 100%);
    aspect-ratio: 1;
}

.qr-image {
    width: 100%;
    height: 100%;
    justify-self: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.qr-logo-mark {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--qr-logo-size, 24%);
    height: var(--qr-logo-size, 24%);
    display: grid;
    place-items: center;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
    transform: translate(-50%, -50%);
}

.qr-logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-park-number {
    justify-self: center;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--soft-blue);
    color: var(--brand-dark);
    font-size: 0.92rem;
    font-weight: 900;
}

.qr-url {
    padding: 8px 10px;
    border-radius: var(--radius);
    background: #f4f7fb;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
    word-break: break-all;
}

.required {
    color: var(--danger);
}

@media (min-width: 760px) {
    .topbar {
        padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
    }

    .brand-row {
        display: flex;
        justify-items: stretch;
        justify-content: space-between;
        gap: 16px;
    }

    .brand {
        flex-direction: row;
        text-align: left;
        justify-content: flex-start;
    }

    .brand-mark {
        width: 152px;
        height: 44px;
    }

    .brand-mark img {
        max-height: 44px;
    }

    .session-actions {
        justify-content: flex-end;
    }

    main {
        padding-bottom: 28px;
    }

    .tabs {
        position: sticky;
        bottom: auto;
        top: 77px;
        max-width: 1160px;
        margin: 0 auto;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow);
        grid-template-columns: repeat(4, minmax(130px, 1fr));
    }

    .tab {
        min-height: 48px;
        grid-auto-flow: column;
        justify-content: center;
    }

    .two-cols {
        grid-template-columns: minmax(330px, 0.9fr) minmax(420px, 1.1fr);
        align-items: start;
    }

    .filter-bar {
        grid-template-columns: 1.2fr 1fr 1fr;
    }

    .split-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, 112px);
    }

    .media-thumb,
    .media-grid video {
        width: 112px;
        height: 112px;
    }

    .admin-module-menu {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .role-access-list,
    .role-access-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .qr-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .toast {
        left: auto;
        width: min(420px, calc(100vw - 28px));
    }
}

/* Modern transport UI refresh */
:root {
    --bg: #eef3f7;
    --panel: #ffffff;
    --ink: #102033;
    --muted: #66778b;
    --line: #d8e2ec;
    --brand: #006d8f;
    --brand-dark: #06364a;
    --ok: #16875d;
    --warn: #bd7100;
    --danger: #d33d45;
    --soft-blue: #e7f6fb;
    --soft-red: #fff0f1;
    --transport-teal: #18b7a5;
    --transport-yellow: #ffc247;
    --surface: #f8fbfd;
    --shadow: 0 16px 42px rgba(16, 32, 51, 0.08);
    --shadow-strong: 0 22px 60px rgba(7, 21, 33, 0.18);
    --radius: 8px;
}

body {
    background:
        linear-gradient(180deg, #eaf2f7 0, #f7f9fb 360px),
        var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}

.auth-gate {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(180deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        radial-gradient(circle at 50% 0, rgba(24, 183, 165, 0.22), transparent 36%),
        linear-gradient(145deg, #06131f, #0b2635 58%, #050a10);
    background-size: 38px 38px, 38px 38px, auto, auto;
}

.auth-card {
    width: min(380px, 100%);
    gap: 16px;
    padding: 18px;
    border-radius: 8px;
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(250, 252, 254, 0.98);
    box-shadow: var(--shadow-strong);
}

.auth-floating-logo {
    width: min(220px, 64vw);
}

.auth-card h1 {
    font-size: 1.45rem;
}

.auth-field {
    border-radius: 8px;
    border-color: #dbe6ef;
    background: var(--surface);
}

.auth-field select,
.auth-field input {
    min-height: 38px;
}

.auth-field:focus-within {
    border-color: var(--transport-teal);
    box-shadow: 0 0 0 4px rgba(24, 183, 165, 0.16);
}

.auth-submit {
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), #079b89);
    box-shadow: 0 16px 32px rgba(0, 109, 143, 0.24);
}

.topbar {
    padding: calc(13px + env(safe-area-inset-top)) 14px 12px;
    background:
        linear-gradient(90deg, rgba(24, 183, 165, 0.18), transparent 34%),
        linear-gradient(135deg, #071521, #0b2b3b 62%, #071521);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 44px rgba(7, 21, 33, 0.26);
}

.brand-row {
    max-width: 1240px;
}

.brand-mark {
    height: 50px;
}

.brand strong {
    font-size: 1.12rem;
    letter-spacing: 0;
}

.brand span {
    color: rgba(232, 244, 250, 0.76);
}

.role-pill {
    min-height: 36px;
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
    color: #edf8fb;
    font-weight: 800;
}

main {
    max-width: 1240px;
    padding-top: 16px;
}

.tabs {
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(248, 251, 253, 0.96);
    border-top-color: rgba(16, 32, 51, 0.1);
    box-shadow: 0 -14px 36px rgba(16, 32, 51, 0.12);
    backdrop-filter: blur(16px);
}

.tab {
    min-height: 58px;
    border-radius: 8px;
    color: #647589;
    font-weight: 800;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.tab svg {
    width: 22px;
    height: 22px;
}

.tab.active {
    background: #071521;
    color: #ffffff;
    box-shadow: inset 0 -3px 0 var(--transport-teal), 0 10px 24px rgba(7, 21, 33, 0.16);
}

.tab:not(:disabled):active {
    transform: translateY(1px) scale(0.99);
}

.panel {
    border-color: rgba(16, 32, 51, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow);
}

.panel-body {
    padding: 16px;
}

.panel-title,
.section-title {
    color: #102033;
    font-weight: 900;
    letter-spacing: 0;
}

.panel-title {
    margin-bottom: 12px;
    font-size: 1.08rem;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 12px;
}

.section-title::before {
    content: "";
    width: 5px;
    height: 20px;
    border-radius: 999px;
    background: var(--transport-teal);
}

.qr-vehicle-notice {
    border-color: rgba(0, 109, 143, 0.18);
    border-left: 5px solid var(--transport-teal);
    background: #edf9f7;
    color: var(--brand-dark);
}

label {
    color: #4f6378;
    font-size: 0.82rem;
}

input,
select,
textarea {
    min-height: 48px;
    border-color: #d6e1eb;
    border-radius: 8px;
    background: #fbfdfe;
    color: #102033;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
    min-height: 118px;
}

input:hover,
select:hover,
textarea:hover {
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--transport-teal);
    box-shadow: 0 0 0 4px rgba(24, 183, 165, 0.16);
}

input[type="file"] {
    padding: 11px;
    background: #f3f8fb;
}

.button {
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand), #079b89);
    box-shadow: 0 12px 24px rgba(0, 109, 143, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button:hover:not(:disabled) {
    box-shadow: 0 16px 34px rgba(0, 109, 143, 0.22);
}

.button:active:not(:disabled) {
    transform: translateY(1px);
}

.button.secondary {
    background: #edf4f7;
    color: #102033;
    box-shadow: none;
}

.button.ghost {
    border-color: rgba(255, 255, 255, 0.18);
    color: #edf8fb;
}

.panel .button.ghost {
    border-color: var(--line);
    color: var(--muted);
}

.button.danger {
    background: linear-gradient(135deg, #d33d45, #b6202a);
}

.hint {
    color: #65778b;
}

.rgpd-notice {
    border-color: rgba(189, 113, 0, 0.22);
    border-left: 5px solid var(--transport-yellow);
    border-radius: 8px;
    background: #fff8e9;
    color: #5b4723;
}

.vehicle-diagram {
    border-color: #d8e4ed;
    background:
        linear-gradient(90deg, rgba(16, 32, 51, 0.04) 1px, transparent 1px),
        linear-gradient(180deg, rgba(16, 32, 51, 0.04) 1px, transparent 1px),
        #ffffff;
    background-size: 22px 22px;
}

.bus-image-map {
    background: transparent;
}

.view-button {
    border-color: #d8e4ed;
    background: #f8fbfd;
    color: #52687d;
}

.view-button.active {
    background: #071521;
    border-color: #071521;
    color: #fff;
    box-shadow: inset 0 -3px 0 var(--transport-teal);
}

.zone-point {
    width: 17px;
    height: 17px;
    min-height: 17px;
    background: var(--brand);
    box-shadow: 0 0 0 4px rgba(0, 109, 143, 0.2), 0 8px 18px rgba(7, 21, 33, 0.24);
}

.zone-point:hover,
.zone-point.selected {
    background: var(--transport-teal);
    box-shadow: 0 0 0 6px rgba(24, 183, 165, 0.24), 0 10px 22px rgba(7, 21, 33, 0.28);
}

.zone-point.has-damage {
    background: var(--danger);
    box-shadow: 0 0 0 6px rgba(211, 61, 69, 0.22), 0 10px 22px rgba(7, 21, 33, 0.24);
}

.filter-bar {
    gap: 10px;
}

.stats {
    gap: 10px;
}

.stat {
    border-color: rgba(16, 32, 51, 0.08);
    border-radius: 8px;
    background:
        linear-gradient(180deg, #ffffff, #f5fafb);
}

.stat strong {
    color: var(--brand-dark);
    font-size: 1.45rem;
}

.cards {
    gap: 12px;
}

.damage-card,
.vehicle-card,
.recap-vehicle-block,
.stat-widget,
.role-access-card,
.qr-card {
    border-color: rgba(16, 32, 51, 0.1);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 34px rgba(16, 32, 51, 0.07);
}

.damage-card,
.vehicle-card {
    padding: 14px;
}

.damage-card {
    border-left: 5px solid var(--transport-teal);
}

.damage-card:has(.status.open) {
    border-left-color: var(--danger);
}

.card-head strong {
    color: #102033;
    font-size: 0.98rem;
}

.meta {
    color: #66778b;
}

.status {
    border-radius: 999px;
    background: #eef4f7;
    color: #52687d;
}

.status.open {
    background: #fff0f1;
    color: #b6202a;
}

.status.repaired {
    background: #e7f8f1;
    color: #14704d;
}

.status.warning {
    background: #fff6df;
    color: #946000;
}

.workshop-progress span {
    background: #eef4f7;
}

.workshop-progress span.done {
    background: #e7f8f1;
    color: #14704d;
}

.media-grid {
    gap: 10px;
}

.media-thumb,
.media-grid video {
    border-color: rgba(16, 32, 51, 0.1);
    border-radius: 8px;
    background: #e7eef4;
}

.media-lightbox {
    background: rgba(3, 12, 19, 0.94);
}

.media-lightbox img {
    border-radius: 8px;
}

.admin-module-menu {
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.admin-module-button {
    min-height: 88px;
    border-radius: 8px;
    border-color: rgba(16, 32, 51, 0.1);
    background:
        linear-gradient(180deg, #ffffff, #f7fbfd);
    box-shadow: 0 12px 30px rgba(16, 32, 51, 0.07);
}

.admin-module-button strong {
    font-size: 0.98rem;
}

.admin-module-button.active {
    border-color: rgba(24, 183, 165, 0.34);
    background:
        linear-gradient(180deg, #f0fbf9, #ffffff);
    color: var(--brand-dark);
    box-shadow: inset 0 4px 0 var(--transport-teal), 0 16px 38px rgba(24, 183, 165, 0.14);
}

.admin-module-button.active span {
    color: #3b6f75;
}

.admin-module-button:disabled {
    background: #eef2f5;
    color: #8996a3;
}

.module-list {
    margin-top: 12px;
}

.qr-park-number {
    background: #071521;
    color: #ffffff;
}

.qr-image {
    border-radius: 8px;
}

.toast {
    border-radius: 8px;
    background: #071521;
    box-shadow: var(--shadow-strong);
}

.empty {
    border-radius: 8px;
    background: #f8fbfd;
}

@media (max-width: 759px) {
    .brand-copy {
        display: none;
    }

    .session-actions {
        width: 100%;
    }

    .role-pill {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .panel-body {
        padding: 14px;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .filter-bar label {
        min-width: 0;
    }

    .admin-module-menu {
        grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
    }

    .admin-module-button {
        min-height: 84px;
        padding: 12px;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
    }

    .media-thumb,
    .media-grid video {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }
}

@media (min-width: 760px) {
    body {
        background:
            linear-gradient(180deg, #e9f1f6 0, #f7f9fb 430px),
            var(--bg);
    }

    .topbar {
        padding: calc(14px + env(safe-area-inset-top)) 22px 14px;
    }

    .brand-mark {
        width: 150px;
    }

    main {
        padding: 18px 18px 34px;
    }

    .tabs {
        top: 82px;
        max-width: 1240px;
        padding: 8px;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.82);
        backdrop-filter: blur(18px);
    }

    .tab {
        min-height: 50px;
        border-radius: 8px;
    }

    .panel-body {
        padding: 18px;
    }

    .two-cols {
        gap: 16px;
        grid-template-columns: minmax(360px, 0.9fr) minmax(480px, 1.1fr);
    }

    .filter-bar {
        gap: 12px;
    }

    .cards {
        gap: 14px;
    }

    .damage-card,
    .vehicle-card {
        padding: 16px;
    }

    .admin-module-menu {
        grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    }
}

@media (min-width: 1100px) {
    .form-grid {
        gap: 14px;
    }

    .admin-module-button:hover:not(:disabled),
    .damage-card:hover,
    .vehicle-card:hover,
    .stat-widget:hover {
        transform: translateY(-1px);
        box-shadow: 0 18px 46px rgba(16, 32, 51, 0.1);
    }
}
