.brand-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex: 0 0 auto;
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .32));
}

.brand {
    gap: 14px;
    padding: 22px 18px;
}

.brand strong {
    font-size: 20px;
    line-height: 1.1;
}

.brand small {
    font-size: 12px;
}

.login-card {
    text-align: center;
}

.login-card .form {
    text-align: left;
}

.login-logo-img {
    width: 178px;
    height: 178px;
    object-fit: contain;
    display: block;
    margin: 0 auto 18px;
    filter: drop-shadow(0 18px 24px rgba(15, 23, 42, .24));
}

.login-card h1 {
    margin: 0 0 6px;
    font-size: 34px;
}

.main-content,
.login-body {
    position: relative;
}

.main-content::before,
.login-body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("../img/fivent-logo.svg");
    background-repeat: no-repeat;
    background-position: center;
    background-size: min(72vw, 760px);
    opacity: .075;
    pointer-events: none;
    z-index: 0;
}

.login-body::before {
    background-size: min(86vw, 820px);
    opacity: .11;
}

.topbar,
.content,
.login-card {
    position: relative;
    z-index: 1;
}

.content > * {
    position: relative;
    z-index: 1;
}

.card,
.table-wrap,
.print-box,
.hero,
.order-view-hero,
.form-header-card,
.profile-hero,
.veh-form-hero,
.hist-search-hero {
    background-clip: padding-box;
}

@media (max-width: 820px) {
    .brand-logo {
        width: 58px;
        height: 58px;
    }

    .login-logo-img {
        width: 150px;
        height: 150px;
    }

    .login-card h1 {
        font-size: 30px;
    }

    .main-content::before {
        background-size: 92vw;
        opacity: .06;
    }

    .login-body::before {
        background-size: 112vw;
        opacity: .09;
    }
}

@media print {
    .main-content::before,
    .login-body::before {
        display: none;
    }
}

html {
    width: 100%;
    max-width: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.app-shell,
.main-content,
.content,
.topbar {
    max-width: 100%;
}

img,
video,
canvas,
svg {
    max-width: 100%;
}

/* Navegacion y paneles: ajustes finales cargados despues de estilo.css */
.sidebar {
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(37, 99, 235, .18), rgba(15, 23, 42, 0) 34%),
        #0f172a;
}

.menu {
    overflow: auto;
    padding-bottom: 12px;
}

.menu-label {
    margin: 12px 12px 4px;
    color: #9ca3af;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.menu a.active {
    background: rgba(255, 255, 255, .14);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--primary), 0 12px 26px rgba(0, 0, 0, .16);
}

.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    object-fit: contain;
    background: #fff;
    padding: 5px;
}

.menu a {
    border: 1px solid transparent;
}

.menu a:hover {
    border-color: rgba(255, 255, 255, .12);
}

.menu-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    background: rgba(255, 255, 255, .08);
    color: #dbeafe;
}

.menu a.active .menu-icon,
.menu a:hover .menu-icon {
    background: rgba(255, 255, 255, .16);
    color: #fff;
}

.menu-icon svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
}

.topbar {
    justify-content: space-between;
    gap: 18px;
    min-height: 78px;
    background:
        linear-gradient(90deg, rgba(13, 110, 253, .08), rgba(255, 255, 255, 0) 36%),
        rgba(255, 255, 255, .94);
    backdrop-filter: blur(14px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.topbar-title {
    min-width: 0;
}

.topbar-title h1,
.topbar-title p {
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.topbar-brand-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #111827;
    border-radius: 999px;
    padding: 7px 11px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .05);
}

.topbar-brand-chip img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.topbar-user {
    text-align: right;
    line-height: 1.2;
}

.topbar-user strong {
    display: block;
    font-size: 14px;
    color: #111827;
}

.topbar-user small {
    display: block;
    color: #64748b;
    font-size: 12px;
    margin-top: 3px;
}

.topbar-refresh,
.topbar-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 12px;
    background: #ef4444;
    color: #fff;
    font-weight: 900;
    padding: 10px 13px;
    box-shadow: 0 10px 22px rgba(239, 68, 68, .18);
}

.topbar-refresh {
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1d4ed8;
    box-shadow: 0 10px 22px rgba(29, 78, 216, .08);
    cursor: pointer;
}

.topbar-refresh:hover {
    background: #dbeafe;
}

.topbar-refresh svg,
.topbar-logout svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.topbar-logout:hover {
    background: #dc2626;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, .48);
    z-index: 9;
    cursor: default;
}

.menu-toggle {
    width: 42px;
    height: 42px;
    padding: 0;
}

.menu-toggle-bars,
.menu-toggle-bars::before,
.menu-toggle-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #111827;
    content: "";
}

.menu-toggle-bars {
    position: relative;
    margin: auto;
}

.menu-toggle-bars::before {
    position: absolute;
    top: -6px;
}

.menu-toggle-bars::after {
    position: absolute;
    top: 6px;
}

.plate-scan-field {
    display: flex;
    gap: 10px;
    align-items: stretch;
    flex-wrap: wrap;
}

.plate-scan-field .form-control {
    min-width: min(360px, 100%);
    flex: 1 1 240px;
}

.plate-scan-button {
    flex: 0 0 auto;
}

.plate-scanner-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 23, 42, .72);
    backdrop-filter: blur(10px);
}

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

.plate-scanner-dialog {
    width: min(780px, 96vw);
    max-height: 94vh;
    overflow: auto;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .35);
    padding: 18px;
}

.plate-scanner-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.plate-scanner-head h2 {
    margin: 0 0 4px;
    color: #111827;
}

.plate-scanner-head p {
    margin: 0;
    color: #64748b;
}

.plate-scanner-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 14px;
    background: #f1f5f9;
    color: #111827;
    font-size: 22px;
    cursor: pointer;
}

.plate-scanner-camera {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 20px;
    background: #020617;
    border: 1px solid #1e293b;
}

.plate-scanner-video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.plate-scanner-frame {
    position: absolute;
    left: 5%;
    top: 43%;
    width: 90%;
    height: 34%;
    border: 3px solid rgba(34, 197, 94, .95);
    border-radius: 18px;
    box-shadow: 0 0 0 999px rgba(2, 6, 23, .36), 0 0 22px rgba(34, 197, 94, .55);
    cursor: move;
    touch-action: none;
    user-select: none;
}

.plate-scanner-frame::before {
    content: "Alinea solo el codigo grande";
    position: absolute;
    left: 50%;
    top: -34px;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, .86);
    color: #fff;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
    pointer-events: none;
}

.plate-scanner-frame [data-handle] {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #22c55e;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .28);
}

.plate-scanner-frame [data-handle="nw"] {
    left: -12px;
    top: -12px;
    cursor: nwse-resize;
}

.plate-scanner-frame [data-handle="ne"] {
    right: -12px;
    top: -12px;
    cursor: nesw-resize;
}

.plate-scanner-frame [data-handle="sw"] {
    left: -12px;
    bottom: -12px;
    cursor: nesw-resize;
}

.plate-scanner-frame [data-handle="se"] {
    right: -12px;
    bottom: -12px;
    cursor: nwse-resize;
}

.plate-scanner-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    color: #64748b;
}

.plate-scanner-tools small {
    line-height: 1.35;
}

.plate-scanner-result {
    margin-top: 14px;
}

.plate-scanner-result label {
    display: block;
    font-weight: 900;
    margin-bottom: 7px;
    color: #374151;
}

.plate-scanner-result input {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-align: center;
}

.plate-scanner-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.plate-scanner-use:disabled {
    opacity: .55;
    cursor: not-allowed;
}

body.plate-scanner-open {
    overflow: hidden;
}

.hero,
.dashboard-hero,
.profile-hero,
.veh-hero,
.veh-form-hero,
.veh-edit-hero,
.hist-search-hero,
.hist-hero,
.cotizacion-hero,
.order-view-hero,
.order-form-hero,
.payment-hero,
.pending-hero,
.report-header,
.form-header-card {
    isolation: isolate;
}

.hero > *,
.dashboard-hero > *,
.profile-hero > *,
.veh-hero > *,
.veh-form-hero > *,
.veh-edit-hero > *,
.hist-search-hero > *,
.hist-hero > *,
.cotizacion-hero > *,
.order-view-hero > *,
.order-form-hero > *,
.payment-hero > *,
.pending-hero > *,
.report-header > *,
.form-header-card > * {
    position: relative;
    z-index: 1;
}

.hero .actions,
.dashboard-hero .actions,
.quick-actions,
.history-actions,
.order-hero-actions {
    position: relative;
    z-index: 2;
}

.hero,
.dashboard-hero,
.profile-hero,
.veh-hero,
.veh-form-hero,
.veh-edit-hero,
.hist-search-hero,
.hist-hero,
.cotizacion-hero,
.order-view-hero,
.order-form-hero,
.payment-hero,
.pending-hero {
    max-width: 100%;
}

.hero .btn,
.dashboard-hero .btn,
.profile-hero .btn,
.veh-hero .btn,
.veh-form-hero .btn,
.veh-edit-hero .btn,
.hist-search-hero .btn,
.hist-hero .btn,
.cotizacion-hero .btn,
.order-view-hero .btn,
.order-form-hero .btn,
.payment-hero .btn,
.pending-hero .btn {
    white-space: normal;
    text-align: center;
}

@media (max-width: 820px) {
    html,
    body {
        min-width: 0;
        overflow-x: hidden;
    }

    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
    }

    .app-shell {
        display: block;
        width: 100%;
    }

    .main-content {
        width: 100%;
        min-width: 0;
    }

    body.sidebar-open .sidebar-backdrop,
    .sidebar.open + .sidebar-backdrop {
        display: block;
    }

    .sidebar {
        width: min(86vw, 300px);
        max-width: 86vw;
        z-index: 30;
    }

    .sidebar-backdrop {
        z-index: 20;
    }

    .menu a:hover {
        transform: none;
    }

    .topbar {
        width: 100%;
        align-items: flex-start;
        flex-wrap: nowrap;
        padding: max(14px, env(safe-area-inset-top)) 14px 14px;
        gap: 10px;
    }

    .topbar-actions {
        margin-left: 0;
        flex: 0 0 auto;
        gap: 8px;
    }

    .topbar-left {
        min-width: 0;
        flex: 1 1 auto;
        gap: 10px;
    }

    .topbar-title {
        min-width: 0;
        flex: 1 1 auto;
    }

    .topbar-user {
        display: none;
    }

    .topbar-brand-chip {
        display: none;
    }

    .topbar-refresh,
    .topbar-logout {
        width: 42px;
        height: 42px;
        padding: 0;
        border-radius: 13px;
        flex: 0 0 auto;
    }

    .topbar-refresh span,
    .topbar-logout span {
        display: none;
    }

    .topbar-title h1 {
        font-size: clamp(19px, 5.4vw, 23px);
        line-height: 1.12;
        overflow-wrap: anywhere;
    }

    .topbar-title p {
        font-size: 13px;
        line-height: 1.25;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
    }

    .content {
        width: 100%;
        padding: 14px;
        overflow-x: hidden;
    }

    .card,
    .table-wrap,
    .print-box {
        width: 100%;
        max-width: 100%;
        border-radius: 16px;
        padding: 16px;
    }

    .section-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .section-title h2 {
        font-size: 20px;
        line-height: 1.2;
    }

    .btn,
    button,
    .form-control,
    .form-select,
    textarea,
    input,
    select {
        font-size: 16px;
    }

    .btn {
        min-height: 42px;
        padding: 10px 12px;
    }

    .actions,
    .quick-actions,
    .history-actions,
    .searchbar {
        width: 100%;
        gap: 8px;
    }

    .actions .btn,
    .searchbar .btn {
        flex: 1 1 150px;
    }

    .searchbar input,
    .searchbar select {
        max-width: none;
        flex: 1 1 100%;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        width: max-content;
        min-width: min(680px, 190vw);
    }

    .hero,
    .dashboard-hero,
    .profile-hero,
    .veh-hero,
    .veh-form-hero,
    .veh-edit-hero,
    .hist-search-hero,
    .hist-hero,
    .cotizacion-hero,
    .order-view-hero,
    .order-form-hero,
    .payment-hero,
    .pending-hero,
    .report-header {
        border-radius: 20px;
        padding: 20px !important;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .hero,
    .profile-hero,
    .veh-hero,
    .veh-form-hero,
    .veh-edit-hero,
    .pending-hero,
    .report-header {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-hero,
    .order-view-hero,
    .order-form-hero,
    .cotizacion-hero,
    .payment-hero,
    .hist-hero,
    .hist-search-hero {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .quick-actions,
    .actions,
    .history-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .quick-actions .btn,
    .hero .actions .btn,
    .profile-hero .actions .btn,
    .veh-hero .actions .btn,
    .hist-search-form .btn,
    .dashboard-hero .btn,
    .hist-hero .btn,
    .order-view-hero .btn,
    .pending-hero .btn {
        width: 100%;
    }

    .plate-scan-button,
    .plate-scanner-actions .btn {
        width: 100%;
    }

    .plate-scanner-dialog {
        width: min(96vw, 760px);
        max-height: 92dvh;
        padding: 14px;
    }

    .plate-scanner-camera {
        aspect-ratio: 4 / 3;
    }
}

@media (min-width: 821px) and (max-width: 1180px) {
    .content {
        padding: 22px;
    }

    .topbar {
        padding: 18px 22px;
    }

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

    .dashboard-hero,
    .panel-grid,
    .dashboard-footer-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .content {
        padding: 10px;
    }

    .topbar {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card,
    .table-wrap,
    .print-box {
        padding: 14px;
    }

    .topbar-title p {
        display: none;
    }
}
