:root {
    color-scheme: light;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f5f7fb;
    color: #172033;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
}

.shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #152238;
    color: #ffffff;
    padding: 24px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #2bb3a3;
    font-weight: 800;
}

.brand small {
    display: block;
    color: #aeb9ca;
    margin-top: 2px;
}

nav {
    display: grid;
    gap: 6px;
}

nav a {
    color: #d7deea;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 6px;
}

nav a.active,
nav a:hover {
    background: #243550;
    color: #ffffff;
}

.content {
    padding: 28px;
    overflow-x: hidden;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.eyebrow {
    color: #5d6b82;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 4px;
    text-transform: uppercase;
}

h1 {
    font-size: 2rem;
    margin: 0;
}

.status-pill,
.primary-action {
    border: 0;
    border-radius: 6px;
    padding: 10px 14px;
    font-weight: 700;
}

.status-pill {
    background: #e9f7f5;
    color: #08786d;
}

.primary-action {
    background: #08786d;
    color: #ffffff;
    cursor: pointer;
}

.primary-action:disabled {
    background: #8ba5a1;
    cursor: wait;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
}

.metric,
.table-panel {
    background: #ffffff;
    border: 1px solid #dde4ef;
    border-radius: 8px;
}

.metric {
    padding: 18px;
}

.metric span {
    color: #5d6b82;
    display: block;
    margin-bottom: 8px;
}

.metric strong {
    font-size: 1.25rem;
}

.filter-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

label {
    color: #40506a;
    display: grid;
    font-size: 0.82rem;
    font-weight: 700;
    gap: 6px;
}

input {
    border: 1px solid #c8d2e2;
    border-radius: 6px;
    color: #172033;
    font: inherit;
    min-height: 40px;
    padding: 8px 10px;
}

.alert {
    background: #fff1f0;
    border: 1px solid #ffccc7;
    border-radius: 6px;
    color: #a8071a;
    margin-bottom: 14px;
    padding: 12px;
}

.table-panel {
    overflow: hidden;
}

.table-summary {
    align-items: baseline;
    border-bottom: 1px solid #dde4ef;
    display: flex;
    gap: 6px;
    padding: 12px 14px;
}

.data-table-wrap {
    overflow-x: auto;
}

.data-table {
    border-collapse: collapse;
    min-width: 920px;
    width: 100%;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid #edf1f7;
    /* Filas ajustadas: el relleno vertical va en 2px a peticion del cliente,
       para que entren mas registros por pantalla. El horizontal se mantiene,
       que es lo que separa una columna de la siguiente. */
    padding: 2px 12px;
    text-align: left;
    white-space: nowrap;
}

.data-table th {
    background: #f8fafc;
    color: #40506a;
    font-size: 0.78rem;
    text-transform: uppercase;
}

.numeric {
    text-align: right;
}

@media (max-width: 900px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 16px;
    }

    nav {
        grid-auto-flow: column;
        justify-content: start;
        overflow-x: auto;
    }

    .content {
        padding: 18px;
    }

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

.session-bar {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.session-bar span {
    color: #40506a;
    font-weight: 700;
}

.ghost-action {
    background: #ffffff;
    border: 1px solid #c8d2e2;
    border-radius: 6px;
    color: #172033;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    min-height: 36px;
    padding: 7px 12px;
}

.login-page {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(21, 34, 56, 0.96), rgba(8, 120, 109, 0.88)),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: auto, 72px 72px, 72px 72px;
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(360px, 460px);
    gap: 48px;
    min-height: 100vh;
    overflow: hidden;
    padding: 56px;
    position: relative;
}

.logistics-scene {
    min-height: 520px;
    position: relative;
}

.route {
    animation: routeFlow 7s linear infinite;
    background: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0,
        rgba(255, 255, 255, 0.1) 22px,
        rgba(43, 179, 163, 0.85) 22px,
        rgba(43, 179, 163, 0.85) 34px);
    border-radius: 999px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
    height: 18px;
    left: 4%;
    position: absolute;
    right: 8%;
    transform: rotate(-14deg);
}

.route-a {
    top: 34%;
}

.route-b {
    animation-direction: reverse;
    opacity: 0.65;
    top: 58%;
    transform: rotate(10deg);
}

.dock-card {
    animation: floatDock 5s ease-in-out infinite;
    backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    color: #ffffff;
    display: grid;
    gap: 8px;
    min-width: 170px;
    padding: 22px;
    position: absolute;
}

.dock-card span {
    color: #7ff3e5;
    font-size: 0.78rem;
    font-weight: 800;
}

.dock-card strong {
    font-size: 1.18rem;
}

.dock-card-a {
    left: 6%;
    top: 20%;
}

.dock-card-b {
    animation-delay: 0.4s;
    left: 42%;
    top: 43%;
}

.dock-card-c {
    animation-delay: 0.8s;
    right: 8%;
    top: 66%;
}

.login-panel {
    backdrop-filter: blur(22px);
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
    padding: 34px;
    position: relative;
    z-index: 2;
}

.login-brand {
    align-items: center;
    display: flex;
    gap: 14px;
    margin-bottom: 30px;
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-form input {
    background: #f8fafc;
    border-color: #d5deeb;
    min-height: 48px;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.login-form input:focus {
    border-color: #08786d;
    box-shadow: 0 0 0 4px rgba(8, 120, 109, 0.12);
    outline: none;
    transform: translateY(-1px);
}

.validation-message {
    color: #a8071a;
    font-size: 0.8rem;
    font-weight: 600;
}

.login-action {
    background: #08786d;
    border: 0;
    border-radius: 6px;
    box-shadow: 0 16px 36px rgba(8, 120, 109, 0.3);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    min-height: 50px;
    transition: box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.login-action:hover {
    background: #06675e;
    box-shadow: 0 20px 46px rgba(8, 120, 109, 0.38);
    transform: translateY(-2px);
}

.login-action:disabled {
    background: #8ba5a1;
    box-shadow: none;
    cursor: wait;
    transform: none;
}

@keyframes routeFlow {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 160px 0;
    }
}

@keyframes floatDock {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

@media (max-width: 980px) {
    .login-page {
        grid-template-columns: 1fr;
        padding: 24px;
    }

    .logistics-scene {
        display: none;
    }

    .login-panel {
        margin: 0 auto;
        max-width: 460px;
        width: 100%;
    }
}

/* Login visual refresh */
.login-page-hero {
    background: #0c1724;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(390px, 470px);
    min-height: 100vh;
    overflow: hidden;
    padding: 0;
    position: relative;
}

.login-visual {
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

.visual-photo,
.visual-overlay,
.motion-grid {
    inset: 0;
    position: absolute;
}

.visual-photo {
    animation: warehousePhotoCycle 24s ease-in-out infinite;
    background-position: center;
    background-size: cover;
    filter: saturate(1.08) contrast(1.04);
    opacity: 0;
    transform: scale(1.04);
}

.visual-photo-a {
    background-image: url("https://images.unsplash.com/photo-1586528116311-ad8dd3c8310d?auto=format&fit=crop&w=1800&q=85");
    opacity: 1;
}

.visual-photo-b {
    animation-delay: 8s;
    background-image: url("https://images.unsplash.com/photo-1566576721346-d4a3b4eaeb55?auto=format&fit=crop&w=1800&q=85");
}

.visual-photo-c {
    animation-delay: 16s;
    background-image: url("https://images.unsplash.com/photo-1601598851547-4302969d0614?auto=format&fit=crop&w=1800&q=85");
}

.visual-overlay {
    background:
        linear-gradient(90deg, rgba(8, 16, 29, 0.32), rgba(8, 16, 29, 0.72)),
        linear-gradient(180deg, rgba(8, 120, 109, 0.16), rgba(9, 24, 42, 0.78));
    z-index: 1;
}

.motion-grid {
    animation: warehouseGridDrift 18s linear infinite;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 76px 76px;
    mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.78), transparent 78%);
    opacity: 0.5;
    z-index: 2;
}

.route-line {
    animation: routePulse 7s linear infinite;
    background: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.16) 0,
        rgba(255, 255, 255, 0.16) 18px,
        rgba(43, 179, 163, 0.95) 18px,
        rgba(43, 179, 163, 0.95) 34px);
    border-radius: 999px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
    height: 12px;
    position: absolute;
    z-index: 3;
}

.route-line-a {
    left: 7%;
    right: 18%;
    top: 28%;
    transform: rotate(-9deg);
}

.route-line-b {
    animation-direction: reverse;
    left: 12%;
    right: 12%;
    top: 54%;
    transform: rotate(6deg);
}

.route-line-c {
    left: 22%;
    right: 8%;
    top: 75%;
    transform: rotate(-4deg);
}

.warehouse-card {
    animation: warehouseFloat 5.8s ease-in-out infinite;
    backdrop-filter: blur(18px);
    background: rgba(7, 18, 32, 0.48);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
    color: #ffffff;
    display: grid;
    gap: 8px;
    min-width: 210px;
    padding: 20px 22px;
    position: absolute;
    z-index: 4;
}

.warehouse-card span {
    color: #78eee0;
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.warehouse-card strong {
    font-size: 1.08rem;
}

.warehouse-card-a {
    left: 8%;
    top: 16%;
}

.warehouse-card-b {
    animation-delay: 0.45s;
    left: 46%;
    top: 42%;
}

.warehouse-card-c {
    animation-delay: 0.9s;
    bottom: 12%;
    right: 10%;
}

.login-access-shell {
    align-items: center;
    background:
        linear-gradient(180deg, rgba(246, 249, 252, 0.98), rgba(234, 241, 248, 0.96));
    display: flex;
    min-height: 100vh;
    padding: 44px;
    position: relative;
    z-index: 5;
}

.login-access-shell::before {
    background: linear-gradient(180deg, rgba(43, 179, 163, 0.18), rgba(8, 120, 109, 0));
    content: "";
    inset: 0 auto 0 -72px;
    position: absolute;
    width: 144px;
}

.login-access-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 8px;
    box-shadow: 0 30px 90px rgba(16, 35, 58, 0.2);
    padding: 34px;
    position: relative;
    width: 100%;
}

.login-brand-modern {
    margin-bottom: 26px;
}

.brand-mark-large {
    box-shadow: 0 18px 40px rgba(8, 120, 109, 0.28);
    height: 52px;
    width: 52px;
}

.login-brand-modern h1 {
    font-size: 2.45rem;
    line-height: 1;
}

.login-copy {
    border-bottom: 1px solid #dbe4ef;
    display: grid;
    gap: 5px;
    margin-bottom: 24px;
    padding-bottom: 22px;
}

.login-copy strong {
    color: #172033;
    font-size: 1.15rem;
}

.login-copy span,
.login-footnote {
    color: #5d6b82;
}

.login-form-modern {
    gap: 18px;
}

.field-shell > span {
    color: #40506a;
    font-size: 0.82rem;
    font-weight: 800;
}

.login-form-modern input {
    background: #f7fafc;
    border: 1px solid #ccd8e6;
    border-radius: 6px;
    min-height: 50px;
    padding: 10px 13px;
}

.login-action-modern {
    min-height: 52px;
}

.login-footnote {
    align-items: center;
    border-top: 1px solid #dbe4ef;
    display: flex;
    font-size: 0.82rem;
    font-weight: 700;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 18px;
}

@keyframes warehousePhotoCycle {
    0%, 26% {
        opacity: 1;
        transform: scale(1.04) translate3d(0, 0, 0);
    }

    34%, 92% {
        opacity: 0;
        transform: scale(1.1) translate3d(-14px, 0, 0);
    }

    100% {
        opacity: 1;
        transform: scale(1.04) translate3d(0, 0, 0);
    }
}

@keyframes warehouseGridDrift {
    from {
        background-position: 0 0, 0 0;
    }

    to {
        background-position: 152px 76px, 152px 76px;
    }
}

@media (max-width: 980px) {
    .login-page-hero {
        grid-template-columns: 1fr;
    }

    .login-visual {
        inset: 0;
        min-height: 100vh;
        position: absolute;
        width: 100%;
    }

    .login-access-shell {
        background: rgba(12, 23, 36, 0.45);
        padding: 24px;
    }

    .login-access-shell::before,
    .warehouse-card,
    .route-line {
        display: none;
    }

    .login-access-card {
        margin: 0 auto;
        max-width: 460px;
    }
}

/* Premium WMS shell and dashboard */
/*
   La columna del menu es "auto" y el ancho lo lleva el propio aside: el
   navegador no interpola grid-template-columns cuando el valor viene de una
   variable (la transicion deja el ancho clavado en el valor anterior), pero
   width si transiciona sin problema.
*/
.app-shell {
    background: #eef3f9;
    grid-template-columns: auto minmax(0, 1fr);
    position: relative;
}

.app-sidebar {
    background: #0d1727;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    height: 100vh;
    min-height: 100vh;
    overflow-y: auto;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    /* Lo ajusta el usuario arrastrando la linea divisoria; app.js escribe la
       variable y la recuerda entre sesiones. */
    width: var(--sidebar-width, 292px);
}

.app-brand {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 22px;
    padding-bottom: 22px;
}

.app-brand strong {
    font-size: 1.15rem;
}

.app-brand strong::after {
    color: #f6c34b;
    content: "";
}

.app-brand small {
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.app-sidebar .brand-mark {
    background: linear-gradient(135deg, #1e64f0, #10223f 62%, #f7c94b);
    box-shadow: 0 14px 34px rgba(30, 100, 240, 0.28);
    color: #ffffff;
    /* "WMS" son tres letras: sin ajuste no entran en el cuadro de 42 px. */
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.side-nav {
    gap: 8px;
}

.nav-section {
    color: #7f8ca3;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    margin: 20px 12px 6px;
    text-transform: uppercase;
}

.side-nav a {
    border: 1px solid transparent;
    color: #b9c4d5;
    font-weight: 700;
    min-height: 44px;
}

.side-nav a.active,
.side-nav a:hover {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.28), rgba(246, 195, 75, 0.08));
    border-color: rgba(77, 128, 235, 0.42);
    color: #ffffff;
}

.app-content {
    padding: 0;
}

.topbar {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid #dbe4ef;
    box-shadow: 0 10px 24px rgba(28, 43, 64, 0.06);
    margin: 0;
    min-height: 74px;
    padding: 16px 28px;
}

.topbar strong {
    color: #172033;
    font-size: 1.25rem;
}

.topbar-actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

.icon-action {
    min-width: 44px;
}

.dashboard-heading,
.dashboard-filter-panel,
.logistics-kpi-grid,
.dashboard-sections {
    margin-left: 28px;
    margin-right: 28px;
}

.dashboard-heading {
    margin-top: 28px;
}

.dashboard-filter-panel {
    background: #ffffff;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(28, 43, 64, 0.08);
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    margin-bottom: 24px;
    padding: 22px;
}

select {
    background: #ffffff;
    border: 1px solid #c8d2e2;
    border-radius: 6px;
    color: #172033;
    font: inherit;
    min-height: 40px;
    padding: 8px 10px;
}

.logistics-kpi-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    margin-bottom: 24px;
}

.kpi-card {
    background: linear-gradient(135deg, #ffffff, #fffaf0);
    box-shadow: 0 14px 30px rgba(28, 43, 64, 0.1);
    min-height: 118px;
    position: relative;
}

.kpi-card::before {
    border-radius: 999px;
    content: "";
    height: 42px;
    opacity: 0.12;
    position: absolute;
    right: 18px;
    top: 18px;
    width: 42px;
}

.kpi-card strong {
    display: block;
    font-size: 2.1rem;
    line-height: 1.05;
    margin-bottom: 8px;
}

.kpi-card small {
    color: #6b7890;
    font-weight: 700;
}

.accent-blue strong,
.accent-blue::before {
    color: #2563eb;
    background: #2563eb;
}

.accent-green strong,
.accent-green::before {
    color: #0f8f75;
    background: #0f8f75;
}

.accent-red strong,
.accent-red::before {
    color: #dc1f4b;
    background: #dc1f4b;
}

.accent-amber strong,
.accent-amber::before {
    color: #d47a00;
    background: #d47a00;
}

.dashboard-sections {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    margin-bottom: 32px;
}

.operation-panel {
    background: #ffffff;
    border: 1px solid #dfe7f2;
    border-radius: 8px;
    box-shadow: 0 14px 30px rgba(28, 43, 64, 0.08);
    padding: 22px;
}

.panel-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.panel-heading h2 {
    font-size: 1.1rem;
    margin: 0;
}

.panel-heading a {
    color: #2563eb;
    font-weight: 800;
    text-decoration: none;
}

.process-list,
.alert-list {
    display: grid;
    gap: 14px;
}

.process-row {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-template-columns: 150px minmax(120px, 1fr) 52px;
}

.process-row span,
.alert-list span {
    color: #5d6b82;
    font-weight: 700;
}

.progress-track {
    background: #edf2f8;
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
}

.progress-track i {
    background: linear-gradient(90deg, #2563eb, #12b99f);
    border-radius: inherit;
    display: block;
    height: 100%;
}

.alert-list div {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e9f3;
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: 44px 1fr;
    padding: 14px;
}

.alert-list strong {
    color: #dc1f4b;
    font-size: 1.4rem;
}

/* Premium animated login */
.login-premium-page {
    background: #071329;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(390px, 530px);
    min-height: 100vh;
    overflow: hidden;
    padding: 0;
    position: relative;
}

.login-premium-visual,
.login-premium-access {
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Capa de fondo de toda la pantalla (foto, video y velo). El degradado es el
   respaldo final si no carga ni la foto ni el video. */
.login-media {
    background:
        radial-gradient(circle at 28% 34%, rgba(59, 112, 214, 0.34), transparent 32%),
        radial-gradient(circle at 84% 76%, rgba(246, 195, 75, 0.18), transparent 28%),
        linear-gradient(135deg, #141b4d, #071329 58%, #0a1730);
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    position: absolute;
    z-index: 0;
}

/* El video (1280x720, 10 s en loop) cubre la pantalla sin deformarse. Parte
   invisible y aparece con un fundido cuando se reproduce, asi no hay un
   cuadro negro entre la foto y el video. */
.login-video {
    height: 100%;
    inset: 0;
    object-fit: cover;
    object-position: center 55%;
    opacity: 0;
    position: absolute;
    transition: opacity 1.2s ease;
    width: 100%;
    z-index: 0;
}

.login-video.is-playing {
    opacity: 1;
}

.login-premium-visual {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 56px min(6vw, 88px) 64px;
}

/* Foto de fondo: se agranda un poco mas que el panel para que la deriva nunca
   descubra un borde. El degradado de la seccion queda debajo como respaldo.

   La imagen va dentro del proyecto, no en un sitio externo: asi la pantalla de
   acceso funciona igual en un servidor sin salida a internet. */
.premium-photo {
    animation: premiumPhotoDrift 34s ease-in-out infinite alternate;
    background-image: url("../img/fondo-wms.jpg");
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: saturate(0.72) contrast(1.06);
    inset: -8%;
    position: absolute;
    will-change: transform;
    z-index: 0;
}

/* Velo en degradado: denso a la izquierda, que es donde va el texto, y liviano
   a la derecha para que la foto se siga viendo. Un velo parejo la tapaba. */
.premium-veil {
    background:
        linear-gradient(0deg, rgba(5, 11, 26, 0.88) 0%, rgba(5, 11, 26, 0.35) 38%, transparent 60%),
        linear-gradient(
            90deg,
            rgba(6, 13, 30, 0.8) 0%,
            rgba(8, 16, 36, 0.45) 30%,
            rgba(8, 16, 36, 0.12) 48%,
            rgba(8, 16, 36, 0.18) 62%,
            rgba(7, 14, 32, 0.72) 82%,
            rgba(6, 12, 28, 0.86) 100%),
        linear-gradient(180deg, rgba(5, 11, 26, 0.55) 0%, transparent 22%);
    inset: 0;
    position: absolute;
    z-index: 1;
}

/* Barrido de luz, el espectro que cruza el panel cada tanto. */
.premium-sweep {
    animation: premiumSweep 13s ease-in-out infinite;
    background: linear-gradient(
        105deg,
        transparent 38%,
        rgba(140, 190, 255, 0.14) 47%,
        rgba(255, 255, 255, 0.1) 52%,
        transparent 62%);
    inset: -20% -60%;
    pointer-events: none;
    position: absolute;
    will-change: transform;
    z-index: 1;
}

@keyframes premiumPhotoDrift {
    from { transform: scale(1.06) translate3d(1.5%, 1%, 0); }
    to { transform: scale(1.18) translate3d(-2%, -1.5%, 0); }
}

@keyframes premiumSweep {
    0% { opacity: 0; transform: translateX(-26%); }
    40% { opacity: 0.85; }
    55% { opacity: 0.85; }
    100% { opacity: 0; transform: translateX(26%); }
}

/* Quien pidio menos movimiento ve la foto quieta. */
@media (prefers-reduced-motion: reduce) {
    .premium-photo,
    .premium-sweep,
    .premium-grid,
    .premium-line,
    .premium-particles span {
        animation: none;
    }

    .premium-photo {
        transform: scale(1.06);
    }

    /* Sin video: queda la foto quieta. */
    .login-video {
        display: none;
    }
}

.premium-particles {
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    position: absolute;
    z-index: 1;
}

.premium-particles span {
    animation: premiumParticleFloat 18s linear infinite;
    background: radial-gradient(circle, rgba(255, 234, 165, 0.95) 0 22%, rgba(72, 142, 255, 0.66) 45%, transparent 72%);
    border-radius: 999px;
    box-shadow: 0 0 18px rgba(101, 166, 255, 0.34), 0 0 34px rgba(255, 206, 88, 0.16);
    height: var(--size, 7px);
    left: var(--x, 50%);
    opacity: var(--alpha, 0.68);
    position: absolute;
    top: var(--y, 50%);
    width: var(--size, 7px);
}

.premium-particles span:nth-child(1) { --x: 8%; --y: 18%; --size: 5px; --alpha: 0.72; animation-duration: 17s; animation-delay: -2s; }
.premium-particles span:nth-child(2) { --x: 16%; --y: 68%; --size: 8px; --alpha: 0.48; animation-duration: 23s; animation-delay: -11s; }
.premium-particles span:nth-child(3) { --x: 25%; --y: 36%; --size: 4px; --alpha: 0.9; animation-duration: 15s; animation-delay: -5s; }
.premium-particles span:nth-child(4) { --x: 31%; --y: 78%; --size: 9px; --alpha: 0.42; animation-duration: 26s; animation-delay: -18s; }
.premium-particles span:nth-child(5) { --x: 39%; --y: 12%; --size: 6px; --alpha: 0.78; animation-duration: 19s; animation-delay: -7s; }
.premium-particles span:nth-child(6) { --x: 46%; --y: 52%; --size: 11px; --alpha: 0.34; animation-duration: 29s; animation-delay: -15s; }
.premium-particles span:nth-child(7) { --x: 55%; --y: 24%; --size: 5px; --alpha: 0.82; animation-duration: 18s; animation-delay: -12s; }
.premium-particles span:nth-child(8) { --x: 62%; --y: 88%; --size: 7px; --alpha: 0.56; animation-duration: 24s; animation-delay: -4s; }
.premium-particles span:nth-child(9) { --x: 69%; --y: 43%; --size: 4px; --alpha: 0.94; animation-duration: 16s; animation-delay: -9s; }
.premium-particles span:nth-child(10) { --x: 75%; --y: 16%; --size: 10px; --alpha: 0.36; animation-duration: 27s; animation-delay: -21s; }
.premium-particles span:nth-child(11) { --x: 83%; --y: 62%; --size: 6px; --alpha: 0.7; animation-duration: 20s; animation-delay: -6s; }
.premium-particles span:nth-child(12) { --x: 91%; --y: 31%; --size: 5px; --alpha: 0.78; animation-duration: 22s; animation-delay: -14s; }
.premium-particles span:nth-child(13) { --x: 12%; --y: 91%; --size: 4px; --alpha: 0.82; animation-duration: 18s; animation-delay: -16s; }
.premium-particles span:nth-child(14) { --x: 28%; --y: 57%; --size: 7px; --alpha: 0.5; animation-duration: 25s; animation-delay: -20s; }
.premium-particles span:nth-child(15) { --x: 51%; --y: 72%; --size: 5px; --alpha: 0.74; animation-duration: 21s; animation-delay: -3s; }
.premium-particles span:nth-child(16) { --x: 66%; --y: 8%; --size: 4px; --alpha: 0.88; animation-duration: 14s; animation-delay: -8s; }
.premium-particles span:nth-child(17) { --x: 79%; --y: 82%; --size: 8px; --alpha: 0.44; animation-duration: 28s; animation-delay: -17s; }
.premium-particles span:nth-child(18) { --x: 94%; --y: 74%; --size: 5px; --alpha: 0.8; animation-duration: 19s; animation-delay: -13s; }
.premium-grid {
    animation: premiumGridDrift 18s linear infinite;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
    background-size: 74px 74px;
    inset: 0;
    /* Sobre el video la grilla va mas tenue y se desvanece hacia la derecha,
       para que no corte en seco donde empieza el panel de acceso. */
    -webkit-mask-image: linear-gradient(90deg, #000 45%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 45%, transparent 100%);
    opacity: 0.6;
    position: absolute;
}

.premium-line {
    animation: premiumLineMove 8s linear infinite;
    background: linear-gradient(180deg, transparent, rgba(83, 139, 245, 0.58), transparent);
    filter: blur(0.4px);
    height: 140%;
    position: absolute;
    top: -20%;
    width: 4px;
}

.premium-line-a {
    left: 24%;
    transform: rotate(14deg);
}

.premium-line-b {
    animation-delay: -2.7s;
    left: 58%;
    opacity: 0.72;
    transform: rotate(14deg);
}

.premium-line-c {
    animation-delay: -5.4s;
    left: 78%;
    opacity: 0.3;
    transform: rotate(14deg);
}

.premium-brand,
.premium-copy,
.premium-stats {
    position: relative;
    z-index: 2;
}

/* La sombra despega el texto de la foto en las zonas mas claras. */
.premium-brand,
.premium-copy,
.premium-stats {
    text-shadow: 0 2px 16px rgba(4, 10, 24, 0.8), 0 1px 3px rgba(4, 10, 24, 0.7);
}

.premium-brand {
    align-items: center;
    color: #ffffff;
    display: flex;
    gap: 16px;
    margin: 0;
}

/* Texto y tarjetas al pie, a la izquierda: el centro de la pantalla queda
   libre para el pasillo y los robots del video. */
.premium-bottom {
    margin-top: auto;
    max-width: 620px;
    padding-top: 48px;
}

.premium-kicker {
    align-items: center;
    background: rgba(45, 212, 191, 0.1);
    border: 1px solid rgba(45, 212, 191, 0.32);
    border-radius: 999px;
    color: #99f6e4;
    display: inline-flex;
    font-size: 0.8rem;
    font-weight: 700;
    gap: 9px;
    letter-spacing: 0.08em;
    padding: 6px 13px;
    text-shadow: none;
    text-transform: uppercase;
}

.premium-kicker::before {
    animation: premiumPulse 1.8s ease-out infinite;
    background: #2dd4bf;
    border-radius: 50%;
    content: "";
    height: 8px;
    width: 8px;
}

@keyframes premiumPulse {
    0% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.55); }
    100% { box-shadow: 0 0 0 10px rgba(45, 212, 191, 0); }
}

.premium-logo {
    background: linear-gradient(135deg, #1e64f0, #10223f 62%, #f7c94b);
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(30, 100, 240, 0.34);
    display: grid;
    font-weight: 900;
    height: 68px;
    place-items: center;
    width: 68px;
}

.premium-brand strong {
    font-size: 2.1rem;
}

.premium-brand strong::after {
    color: #f6c34b;
    content: "";
}

.premium-copy h1 {
    color: #ffd45c;
    font-size: clamp(2.1rem, 3.6vw, 3.3rem);
    letter-spacing: -0.02em;
    line-height: 1.04;
    margin: 16px 0 12px;
    max-width: 600px;
}

.premium-copy p {
    color: rgba(230, 236, 246, 0.86);
    font-size: 1.12rem;
    line-height: 1.55;
    margin: 0;
    max-width: 500px;
}

.premium-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 32px;
}

/* Tarjetas de vidrio: el desenfoque las despega del video que se mueve detras. */
.premium-stats article {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background: rgba(10, 20, 42, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    display: grid;
    gap: 6px;
    min-width: 128px;
    padding: 16px 20px;
}

.premium-stats strong {
    color: #ffbd2f;
    font-size: 1.5rem;
}

.premium-stats span {
    color: #95a3ba;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Sin fondo propio: el video sigue por detras y el velo ya oscurece este lado. */
.login-premium-access {
    align-items: center;
    background: transparent;
    display: flex;
    padding: 44px;
}

.premium-access-card {
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    background: rgba(10, 22, 46, 0.66);
    border: 1px solid rgba(255, 212, 92, 0.35);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
    color: #ffffff;
}

.premium-access-card h2 {
    font-size: 1.85rem;
    margin: 4px 0 26px;
}

.premium-field > span {
    color: #ffbd2f;
}

.premium-form input {
    background: #eaf2ff;
    border-color: rgba(87, 145, 238, 0.7);
    border-radius: 8px;
    color: #101827;
}

.premium-login-action {
    background: linear-gradient(135deg, #4285f4, #2448bf);
    box-shadow: 0 18px 42px rgba(48, 101, 229, 0.32);
}

.premium-alert {
    margin-bottom: 0;
}

.premium-footnote {
    border-top-color: rgba(255, 255, 255, 0.1);
    color: #92a0b8;
}

/* Estado del WMS en el pie del acceso: verde cuando la API responde y rojo
   cuando no, con un punto delante para reconocerlo sin leer. */
.wms-estado {
    align-items: center;
    display: inline-flex;
    gap: 7px;
    white-space: nowrap;
}

.wms-estado::before {
    background: currentColor;
    border-radius: 50%;
    content: "";
    height: 8px;
    width: 8px;
}

.wms-activo { color: #6ee7a8; }

.wms-inactivo { color: #ff9a9a; }

.wms-verificando { color: #a9b6cc; }

/* La API responde, pero en otra version que la Web: se publico una sin la otra. */
.wms-desfasado { color: #ffd27a; }

@keyframes premiumGridDrift {
    from { background-position: 0 0, 0 0; }
    to { background-position: 148px 74px, 148px 74px; }
}

@keyframes premiumLineMove {
    from { translate: -120px 0; }
    to { translate: 160px 0; }
}
@keyframes premiumParticleFloat {
    0% { transform: translate3d(0, 0, 0) scale(0.72); }
    35% { transform: translate3d(34px, -62px, 0) scale(1); }
    70% { transform: translate3d(-24px, -118px, 0) scale(0.86); }
    100% { transform: translate3d(18px, -184px, 0) scale(0.72); }
}

@media (max-width: 980px) {
    .app-shell,
    .login-premium-page,
    .dashboard-sections {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        min-height: auto;
    }

    .dashboard-filter-panel,
    .logistics-kpi-grid {
        grid-template-columns: 1fr;
    }

    .login-premium-visual {
        min-height: 380px;
        padding: 42px 24px;
    }

    .premium-brand {
        margin: 0;
    }

    .premium-stats {
        margin-top: 24px;
    }

    .login-premium-access {
        min-height: auto;
        padding: 24px;
    }
}

.auth-checking {
    align-items: center;
    background: #071329;
    color: #d7deea;
    display: grid;
    min-height: 100vh;
    place-items: center;
}

.auth-checking span {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    font-weight: 800;
    padding: 16px 20px;
}

/* Maintenance screens */
.maintenance-heading {
    align-items: flex-end;
}

.maintenance-panel {
    background: #ffffff;
    border: 1px solid #dbe4ef;
    display: grid;
    gap: 14px;
    padding: 16px;
}

.maintenance-form-grid {
    display: grid;
    gap: 10px 14px;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.client-form-grid {
    grid-template-columns: 120px 190px minmax(260px, 1fr) 230px;
}

.maintenance-form-grid label {
    color: #26374d;
    display: grid;
    font-size: 0.82rem;
    font-weight: 700;
    gap: 4px;
}

.maintenance-form-grid input,
.maintenance-form-grid select {
    background: #ffffff;
    border: 1px solid #aeb8c5;
    border-radius: 2px;
    color: #142033;
    min-height: 30px;
    padding: 4px 8px;
}

.maintenance-form-grid .readonly-field {
    background: #fffec0;
}

.maintenance-form-grid .span-2 {
    grid-column: span 2;
}

.maintenance-actions,
.grid-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.maintenance-actions button {
    min-width: 132px;
}

.success-alert {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
    margin: 14px 0;
    padding: 12px 14px;
}

.maintenance-table-panel {
    margin-top: 14px;
}

.grid-toolbar {
    border-bottom: 1px solid #dbe4ef;
    justify-content: space-between;
    padding: 12px 14px;
}

.grid-toolbar input {
    border: 1px solid #aeb8c5;
    border-radius: 2px;
    min-height: 32px;
    min-width: min(520px, 100%);
    padding: 5px 8px;
}

.grid-toolbar span {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 800;
}

.maintenance-table th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.maintenance-table tbody tr {
    cursor: pointer;
}

.maintenance-table tbody tr:hover,
.maintenance-table .selected-row {
    background: #eaf2ff;
}

@media (max-width: 980px) {
    .maintenance-form-grid,
    .client-form-grid {
        grid-template-columns: 1fr;
    }

    .maintenance-form-grid .span-2 {
        grid-column: auto;
    }

    .maintenance-actions button,
    .grid-toolbar input {
        width: 100%;
    }
}

/* Premium maintenance refinements */
.maintenance-hero {
    align-items: center;
    background: linear-gradient(135deg, #f8fbff, #e9f1fb);
    border: 1px solid #d8e3f0;
    display: flex;
    justify-content: space-between;
    margin: 0 0 16px;
    padding: 22px 24px;
}

.maintenance-hero h1 {
    color: #082348;
    font-size: 2rem;
    line-height: 1.1;
    margin: 2px 0 0;
}

.record-pill,
.status-chip {
    background: #eef6ff;
    border: 1px solid #cfe2f7;
    color: #23527c;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 7px 10px;
    text-transform: uppercase;
}

.maintenance-card {
    background: #ffffff;
    border: 1px solid #d8e3f0;
    box-shadow: 0 18px 44px rgba(25, 46, 74, 0.08);
    display: grid;
    gap: 18px;
    padding: 20px;
}

.maintenance-card-header {
    align-items: center;
    border-bottom: 1px solid #e4edf7;
    display: flex;
    justify-content: space-between;
    padding-bottom: 14px;
}

.maintenance-card-header strong {
    color: #132a48;
    display: block;
    font-size: 1.05rem;
}

.section-kicker {
    color: #64748b;
    display: block;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.client-card .maintenance-form-grid label {
    color: #10233f;
    font-size: 0.76rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.client-card .maintenance-form-grid input,
.client-card .maintenance-form-grid select {
    border: 1px solid #b8c7d9;
    border-radius: 6px;
    font-weight: 700;
    min-height: 36px;
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.client-card .maintenance-form-grid input:focus,
.client-card .maintenance-form-grid select:focus {
    border-color: #2d6cdf;
    box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.14);
}

.client-card .readonly-field {
    background: #fffbc2;
}

.premium-actions {
    border-top: 1px solid #e4edf7;
    padding-top: 16px;
}

.tool-button,
.primary-tool {
    align-items: center;
    border: 1px solid #b7c7da;
    border-radius: 6px;
    color: #14304f;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    gap: 8px;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.tool-button {
    background: #ffffff;
}

.tool-button:hover,
.primary-tool:hover {
    border-color: #2d6cdf;
    box-shadow: 0 8px 20px rgba(28, 55, 91, 0.12);
    transform: translateY(-1px);
}

.primary-tool {
    background: #087f70;
    border-color: #087f70;
    color: #ffffff;
}

.primary-tool:disabled {
    cursor: wait;
    opacity: 0.72;
}

.button-icon {
    border-radius: 4px;
    display: inline-grid;
    flex: 0 0 18px;
    height: 18px;
    place-items: center;
    position: relative;
    width: 18px;
}

.icon-new::before,
.icon-new::after {
    background: #2563eb;
    content: "";
    position: absolute;
}

.icon-new::before { height: 2px; width: 14px; }
.icon-new::after { height: 14px; width: 2px; }

.icon-save {
    border: 2px solid currentColor;
}

.icon-save::before {
    background: currentColor;
    content: "";
    height: 5px;
    left: 3px;
    position: absolute;
    top: 3px;
    width: 10px;
}

.icon-pdf,
.icon-xlsx {
    background: #eef4fb;
    border: 1px solid #c6d6e8;
    color: #1f3b5e;
    font-size: 0.55rem;
    font-weight: 900;
}

.icon-pdf::before { content: "PDF"; }
.icon-xlsx::before { content: "X"; }

.icon-print {
    background: #eef4fb;
    border: 1px solid #c6d6e8;
    color: #1f3b5e;
    font-size: 0.55rem;
    font-weight: 900;
}

.icon-print::before { content: "ZPL"; }

/* Recargar: dos flechas enfrentadas. Antes era un anillo abierto, que se leia
   como un indicador de carga detenido. */
.icon-refresh {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
}

.icon-refresh::before { content: "\21BB"; }

.premium-grid-panel {
    border: 1px solid #d8e3f0;
    box-shadow: 0 16px 34px rgba(25, 46, 74, 0.07);
    overflow: hidden;
}

.premium-grid-toolbar {
    background: #f8fbff;
    border-bottom: 1px solid #d8e3f0;
}

.premium-grid-toolbar label {
    display: grid;
    gap: 5px;
}

.premium-grid-toolbar label span {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.premium-grid-toolbar strong {
    color: #35506f;
    font-size: 0.86rem;
}

.premium-data-table thead th {
    background: #183556;
    border-bottom: 1px solid #0f2742;
    color: #ffffff;
    font-size: 0.74rem;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.premium-data-table thead th span {
    display: inline-block;
    margin-right: 8px;
}

.sort-indicator {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    display: inline-block;
    height: 0;
    opacity: 0.35;
    vertical-align: middle;
    width: 0;
}

.sort-indicator::after {
    content: none;
}

.sort-asc {
    border-bottom: 7px solid #f8c44f;
    opacity: 1;
}

.sort-desc {
    border-top: 7px solid #f8c44f;
    opacity: 1;
}

.premium-data-table tbody tr:nth-child(even) {
    background: #f9fbfe;
}

.premium-data-table tbody td {
    border-bottom: 1px solid #e5edf6;
}

.state-badge {
    background: #eef6ff;
    border: 1px solid #cfe2f7;
    color: #1c4f82;
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 3px 8px;
}

.modal-backdrop {
    align-items: center;
    background: rgba(7, 19, 41, 0.54);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 24px;
    position: fixed;
    z-index: 2000;
}

.message-modal {
    background: #ffffff;
    border: 1px solid #f1b8b8;
    box-shadow: 0 30px 90px rgba(7, 19, 41, 0.32);
    color: #172033;
    display: grid;
    gap: 16px;
    grid-template-columns: auto 1fr;
    max-width: 560px;
    padding: 24px;
    width: min(560px, 100%);
}

.message-modal-icon {
    align-items: center;
    background: #fff1f1;
    border: 1px solid #f3b6b6;
    border-radius: 999px;
    color: #bd1f2d;
    display: flex;
    font-size: 1.2rem;
    font-weight: 900;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.message-modal h2 {
    color: #851a24;
    font-size: 1.2rem;
    margin: 0 0 8px;
}

.message-modal p {
    color: #334155;
    line-height: 1.5;
    margin: 0;
    white-space: pre-line;
}

.message-modal .modal-action {
    grid-column: 2;
    justify-self: end;
    min-width: 110px;
}

@media (max-width: 720px) {
    .maintenance-hero,
    .maintenance-card-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .message-modal {
        grid-template-columns: 1fr;
    }

    .message-modal .modal-action {
        grid-column: auto;
        justify-self: stretch;
    }
}

/* Compact top bar */
.topbar {
    min-height: 56px;
    padding: 9px 22px;
}

.topbar-compact {
    justify-content: flex-end;
    min-height: 42px;
    padding: 6px 18px;
}

.topbar-title .eyebrow {
    margin-bottom: 2px;
}

.session-user {
    color: #29405f;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1;
}

.logoff-action {
    align-items: center;
    background: #ffffff;
    border: 1px solid #bfcbdb;
    border-radius: 6px;
    color: #163456;
    cursor: pointer;
    display: inline-flex;
    height: 34px;
    justify-content: center;
    padding: 0;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
    width: 38px;
}

.logoff-action:hover {
    background: #fff1f1;
    border-color: #ef9f9f;
    color: #b91c1c;
}

.logoff-action span {
    border: 2px solid currentColor;
    border-left-color: transparent;
    border-radius: 999px;
    display: block;
    height: 16px;
    position: relative;
    width: 16px;
}

.logoff-action span::before {
    background: currentColor;
    content: "";
    height: 8px;
    left: 6px;
    position: absolute;
    top: -6px;
    width: 2px;
}

@media (max-width: 720px) {
    .topbar,
    .topbar-compact {
        min-height: 44px;
        padding: 6px 12px;
    }

    .session-user {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Compact Clientes page */
.compact-maintenance-hero {
    margin-bottom: 10px;
    min-height: 46px;
    padding: 10px 18px;
}

.compact-maintenance-hero h1 {
    font-size: 1.18rem;
    margin: 0;
}

.compact-maintenance-hero .record-pill {
    padding: 5px 9px;
}

.compact-client-card {
    gap: 12px;
    padding: 14px 18px 16px;
}

.compact-client-card .maintenance-form-grid {
    gap: 10px 14px;
}

.compact-client-card .premium-actions {
    padding-top: 14px;
}

/* ---------- Menu dinamico ---------- */

/* Sin minmax(0, ...) el track crece a max-content y los titulos largos
   desbordan el sidebar en vez de recortarse con ellipsis. */
.side-nav {
    grid-template-columns: minmax(0, 1fr);
}

.nav-icon {
    flex: 0 0 auto;
    height: 18px;
    opacity: 0.85;
    width: 18px;
}

.side-nav .nav-link {
    align-items: center;
    display: flex;
    gap: 10px;
    text-decoration: none;
}

.side-nav a.active .nav-icon {
    opacity: 1;
}

.nav-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Cabecera desplegable de cada pagina del menu */
.nav-page {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #8ea0bd;
    cursor: pointer;
    display: flex;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    gap: 10px;
    letter-spacing: 0.08em;
    margin-top: 10px;
    min-height: 42px;
    padding: 10px 12px;
    text-align: left;
    text-transform: uppercase;
    transition: background 0.15s ease, color 0.15s ease;
    width: 100%;
}

.nav-page:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
}

.nav-page.is-open {
    color: #ffffff;
}

.nav-count {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #b9c4d5;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0;
    min-width: 22px;
    padding: 2px 7px;
    text-align: center;
}

.nav-chevron {
    border-bottom: 2px solid currentColor;
    border-right: 2px solid currentColor;
    flex: 0 0 auto;
    height: 7px;
    transform: rotate(-45deg);
    transition: transform 0.18s ease;
    width: 7px;
}

.nav-page.is-open .nav-chevron {
    transform: rotate(45deg);
}

.nav-page-items {
    animation: navReveal 0.18s ease;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 4px;
    margin: 4px 0 4px 22px;
    padding-left: 8px;
}

@keyframes navReveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-subsection {
    color: #93a3bd;
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin: 8px 12px 2px;
    text-transform: uppercase;
}

.side-nav .nav-disabled {
    color: #5c6b85;
    cursor: not-allowed;
    font-weight: 700;
    min-height: 40px;
    opacity: 0.7;
    padding: 8px 12px;
}

.nav-error {
    color: #fca5a5;
    display: block;
    font-size: 0.75rem;
    margin: 6px 12px;
}

/* Boton para contraer / expandir el sidebar */
.sidebar-toggle {
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #b9c4d5;
    cursor: pointer;
    display: flex;
    flex: 0 0 auto;
    height: 30px;
    justify-content: center;
    margin-left: auto;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
    width: 30px;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.sidebar-toggle-icon {
    border-bottom: 2px solid currentColor;
    border-left: 2px solid currentColor;
    height: 8px;
    margin-left: 3px;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    width: 8px;
}

.sidebar-collapsed .sidebar-toggle-icon {
    margin-left: -3px;
    transform: rotate(-135deg);
}

/* Sidebar contraido: solo iconos */
.sidebar-collapsed {
    padding: 24px 12px;
}

.sidebar-collapsed .app-brand,
.sidebar-collapsed .brand {
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}

.sidebar-collapsed .sidebar-toggle {
    margin-left: 0;
}

.side-nav-icons .nav-link {
    justify-content: center;
    padding: 10px 0;
    width: 100%;
}

/* Scrollbar delgado y con espacio reservado a ambos lados: uno normal
   descentra los iconos cuando el sidebar esta contraido. */
.app-sidebar {
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
    scrollbar-gutter: stable both-edges;
    scrollbar-width: thin;
}

.app-sidebar::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.nav-divider {
    background: rgba(255, 255, 255, 0.1);
    display: block;
    height: 1px;
    margin: 8px 0;
    width: 100%;
}

@media (min-width: 901px) {
    .app-sidebar {
        transition: width 0.2s ease;
    }

    /* Contraido manda sobre el ancho ajustado: el boton del logo sigue igual. */
    .app-sidebar.sidebar-collapsed {
        width: 78px;
    }
}

/* ---------- Linea divisoria arrastrable del menu ---------- */

.sidebar-resizer {
    bottom: 0;
    cursor: col-resize;
    left: var(--sidebar-width, 292px);
    margin-left: -4px;
    position: absolute;
    top: 0;
    touch-action: none;
    width: 8px;
    z-index: 30;
}

/* La linea visible es delgada; el area que se puede agarrar es mas ancha. */
.sidebar-resizer::after {
    background: transparent;
    content: "";
    inset: 0 3px;
    position: absolute;
    transition: background-color 120ms ease;
}

.sidebar-resizer:hover::after,
.sidebar-resizer:focus-visible::after,
body.is-resizing .sidebar-resizer::after {
    background: #2d6cdf;
}

.sidebar-resizer:focus-visible {
    outline: none;
}

/* Durante el arrastre: sin transicion (seguiria al puntero con retardo) y sin
   seleccionar texto de la pantalla. */
body.is-resizing {
    cursor: col-resize;
    user-select: none;
}

body.is-resizing .app-sidebar {
    transition: none;
}

/* En pantallas angostas el menu va arriba, a lo ancho: no hay que arrastrar. */
@media (max-width: 900px) {
    .sidebar-resizer {
        display: none;
    }

    .app-sidebar {
        width: auto;
    }
}

/* ---------- Catalogos ---------- */

.flag-field {
    height: 18px;
    margin-top: 8px;
    width: 18px;
}

.danger-tool {
    border-color: #dc2626 !important;
    color: #dc2626 !important;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ---------- Asignaciones ---------- */

.assignment-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.assignment-hint {
    color: #64748b;
    font-style: italic;
    margin: 4px 0;
}

/* Doble listado: los dos paneles reparten el ancho, y cada uno lleva su propio
   scroll (la clase grid-panel-flex es la que le da alto acotado a la grilla). */
.assignment-columns {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}

.assignment-panel {
    min-height: 320px;
}

@media (min-width: 981px) {
    .assignment-columns {
        flex: 1 1 auto;
        min-height: 0;
    }
}

.warning-alert {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
    margin: 4px 0;
    padding: 12px 14px;
}

.error-alert {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    margin: 4px 0;
    padding: 12px 14px;
}

/* ---------- Indicadores de actividad ---------- */

/* Barra superior: se muestra en cualquier llamada al API */
.busy-bar {
    background: rgba(37, 99, 235, 0.14);
    height: 3px;
    left: 0;
    overflow: hidden;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 1200;
}

.busy-bar-fill {
    animation: busySlide 1.1s ease-in-out infinite;
    background: linear-gradient(90deg, transparent, #2563eb 45%, #f6c34b);
    display: block;
    height: 100%;
    width: 40%;
}

@keyframes busySlide {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(320%);
    }
}

.spinner {
    animation: spinnerTurn 0.7s linear infinite;
    border: 2.5px solid rgba(37, 99, 235, 0.22);
    border-radius: 50%;
    border-top-color: #2563eb;
    display: inline-block;
    flex: 0 0 auto;
    height: 26px;
    width: 26px;
}

.spinner-sm {
    border-width: 2px;
    height: 15px;
    width: 15px;
}

.primary-tool .spinner-sm {
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
}

@keyframes spinnerTurn {
    to {
        transform: rotate(360deg);
    }
}

/* Capa sobre la grilla mientras se cargan los datos */
.data-table-wrap {
    position: relative;
}

.loading-overlay {
    align-items: center;
    background: rgba(255, 255, 255, 0.78);
    display: flex;
    flex-direction: column;
    gap: 10px;
    inset: 0;
    justify-content: center;
    min-height: 140px;
    position: absolute;
    z-index: 5;
}

.loading-text {
    color: #33507d;
    font-size: 0.86rem;
    font-weight: 700;
}

.empty-row td {
    color: #64748b;
    font-style: italic;
    padding: 22px 14px;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .busy-bar-fill,
    .spinner {
        animation-duration: 2.4s;
    }
}

/* ---------- Grilla con cabecera fija y scroll propio ---------- */

/* En escritorio la pantalla ocupa el alto del viewport y la grilla toma el
   espacio sobrante, de modo que sus barras de scroll (vertical y horizontal)
   quedan siempre a la vista sin tener que llegar al final del listado. */
@media (min-width: 981px) {
    .app-shell {
        height: 100vh;
    }

    .app-content {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow-y: auto;
    }

    .page-shell {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
    }

    .grid-panel-flex {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 260px;
    }

    .grid-panel-flex .data-table-wrap {
        flex: 1 1 auto;
        min-height: 0;
    }
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
}

.data-table-wrap {
    overflow: auto;
    overscroll-behavior: contain;
}

/* separate + spacing 0: con border-collapse los bordes de las celdas fijas
   se pierden al desplazar */
.data-table {
    border-collapse: separate;
    border-spacing: 0;
}

/* Sin background propio: lo aporta cada variante de tabla. Redefinirlo aca
   pisaria la cabecera oscura de .premium-data-table (texto blanco). */
.data-table thead th {
    box-shadow: inset 0 -1px 0 #dbe4ef;
    position: sticky;
    top: 0;
    z-index: 3;
}

.premium-data-table thead th {
    box-shadow: inset 0 -1px 0 #0f2742;
    z-index: 3;
}

/* Grilla ajustada (LPN Recepcionados de Entradas): cada columna toma el ancho
   de su contenido en vez de repartirse el ancho de la pantalla, con menos
   separacion entre columnas. Las dos barras de desplazamiento quedan siempre
   visibles, aunque el contenido quepa. */
.data-table.grid-ajustada {
    min-width: 0;
    width: auto;
}

.data-table.grid-ajustada th,
.data-table.grid-ajustada td {
    line-height: 1.25;
    padding: 2px 8px;
}

.grid-ajustada .select-col input[type="checkbox"] {
    margin: 0;
    vertical-align: middle;
}

.data-table-wrap:has(> .grid-ajustada) {
    overflow: scroll;
}

/* Formulario colapsable para ganar alto de grilla */
.header-toggle {
    background: #ffffff;
    border: 1px solid #c3d6ec;
    border-radius: 4px;
    color: #1d4e89;
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 6px 12px;
    white-space: nowrap;
}

.header-toggle:hover {
    background: #eef6ff;
}

.hero-actions {
    align-items: center;
    display: flex;
    gap: 10px;
}

/* Ancla del overlay de carga: sin esto se posiciona contra el viewport.
   Fuera del media query porque tambien aplica en pantallas angostas. */
.grid-panel-flex {
    position: relative;
}

/* En pantallas angostas no hay layout de alto completo, pero la grilla igual
   necesita alto acotado para que su barra horizontal quede a la vista. */
@media (max-width: 980px) {
    .grid-panel-flex .data-table-wrap {
        max-height: 70vh;
    }
}

.grid-panel-flex .loading-overlay {
    z-index: 6;
}

/* ---------- Pestanas y editor de detalle (Entradas) ---------- */

/* Interruptor "Actualizar automatico" de Entradas, en la barra de la grilla */
.auto-refresh {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.premium-grid-toolbar .auto-refresh label {
    align-items: center;
    color: #35506f;
    cursor: pointer;
    display: flex;
    font-size: 0.8rem;
    font-weight: 800;
    gap: 6px;
    white-space: nowrap;
}

.auto-refresh input[type="checkbox"] {
    height: 16px;
    margin: 0;
    min-height: 16px;
    width: 16px;
}

.auto-refresh small {
    color: #64748b;
    font-size: 0.72rem;
}

.auto-refresh .auto-refresh-error {
    color: #b91c1c;
}

.tab-toolbar {
    align-items: center;
}

.tab-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tab-button {
    background: #ffffff;
    border: 1px solid #c3d6ec;
    border-radius: 4px 4px 0 0;
    color: #35506f;
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 8px 14px;
}

.tab-button:hover {
    background: #eef6ff;
}

.tab-button.is-active {
    background: #183556;
    border-color: #183556;
    color: #ffffff;
}

.detail-editor {
    align-items: end;
    background: #f8fbff;
    border-bottom: 1px solid #d8e3f0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 14px;
}

.detail-editor > label {
    display: grid;
    gap: 4px;
    min-width: 170px;
}

.detail-editor input {
    border: 1px solid #aeb8c5;
    border-radius: 2px;
    min-height: 32px;
    padding: 5px 8px;
}

.detail-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

.detail-hint {
    color: #35506f;
    font-size: 0.84rem;
    font-weight: 800;
}

.material-matches {
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    display: grid;
    gap: 8px;
    padding: 12px 14px;
}

.material-matches > span {
    color: #92400e;
    font-size: 0.84rem;
    font-weight: 800;
}

.material-match-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.inline-field {
    display: grid;
    gap: 4px;
    min-width: 220px;
}

.inline-field input {
    border: 1px solid #aeb8c5;
    border-radius: 2px;
    min-height: 32px;
    padding: 5px 8px;
}

/* ---------- Popup de seleccion de material ---------- */

.picker-modal {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 30px 90px rgba(12, 26, 47, 0.36);
    display: flex;
    flex-direction: column;
    max-height: min(640px, 88vh);
    overflow: hidden;
    width: min(880px, 94vw);
}

/* Recepcion por pantalla: mismo marco que el buscador de materiales, pero mas
   ancho y con dos grillas abajo (la orden y lo ya cargado al LPN). */
.lpn-modal {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 30px 90px rgba(12, 26, 47, 0.36);
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: min(880px, 92vh);
    overflow: auto;
    padding-bottom: 4px;
    width: min(1240px, 96vw);
}

.lpn-modal > .maintenance-form-grid,
.lpn-modal > .maintenance-actions,
.lpn-modal > .error-alert,
.lpn-modal > .success-alert,
.lpn-modal > .warning-alert,
.lpn-modal > .lpn-modal-grids {
    margin: 0 18px;
}

.lpn-modal-grids {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
}

.lpn-modal-table {
    max-height: 260px;
    overflow: auto;
}

/* Asignacion masiva de operador: el mismo marco del buscador, mas ancho porque
   la lista trae ocho columnas, y con la grilla desplazandose por dentro. */
.operator-modal {
    gap: 12px;
    max-height: min(760px, 92vh);
    width: min(1100px, 96vw);
}

.operator-modal > .maintenance-form-grid,
.operator-modal > .error-alert,
.operator-modal > .success-alert,
.operator-modal > .operator-modal-grid {
    margin: 0 18px;
}

.operator-modal-grid {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
}

/* Semaforo de avance: sin avance, parcial y completo. El color del texto va
   oscuro sobre fondo claro para que se lea sin esfuerzo. */
.cell-sin-avance {
    background: #fde2e2;
    color: #8a1c1c;
    font-weight: 800;
}

.cell-parcial {
    background: #ffedd5;
    color: #9a3412;
    font-weight: 800;
}

/* El Monitor de Picking usa amarillo para el parcial, como el escritorio. */
.cell-parcial-amarillo {
    background: #fef3c0;
    color: #7a4c00;
    font-weight: 800;
}

.cell-completo {
    background: #dcfce7;
    color: #14653a;
    font-weight: 800;
}

/* Gris: no hay avance que medir, como un documento de transporte sin ordenes. */
.cell-neutro {
    background: #e6ebf2;
    color: #3f4c60;
    font-weight: 800;
}

/* Celda que abre una direccion en otra pestana al recibir doble clic: se
   muestra como enlace para que se note que lleva a alguna parte. */
.cell-link {
    color: #1d4ed8;
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Celda que abre algo en la misma pantalla con un clic (DynamicGrid CellAction). */
.cell-action {
    color: #1d4ed8;
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.cell-action:hover { color: #1e40af; text-decoration-style: solid; }

/* Kardex: el signo del movimiento se lee por el color del numero, sin fondo.
   Lo que entra en azul y lo que sale en rojo. */
.cell-cantidad-positiva {
    color: #1d4ed8;
    font-weight: 700;
}

.cell-cantidad-negativa {
    color: #b91c1c;
    font-weight: 700;
}

/* Fila de totales: se queda pegada abajo mientras la grilla se desplaza. */
.totals-row td {
    background: #eef4fb;
    border-top: 2px solid #c3d6ec;
    bottom: 0;
    font-weight: 800;
    position: sticky;
    z-index: 2;
}

/* Procesa Ola: a la izquierda los materiales de la ola y a la derecha el
   origen del stock (LPN, zonas o lotes), como las dos mitades del escritorio. */
.wave-process {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
    min-height: 0;
    padding: 14px;
}

.wave-process-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Cada panel lleva su propio scroll: sin alto acotado la grilla crece con sus
   miles de filas, el panel de afuera recorta lo que sobra y las barras quedan
   fuera de la pantalla. */
.wave-process-panel .data-table-wrap,
.wave-source-table {
    flex: 1 1 auto;
    min-height: 220px;
    overflow: auto;
}

@media (min-width: 981px) {
    /* La fila del grid se fija a 1fr: dejada en auto crece con las miles de
       filas de la grilla y se lleva el alto de los dos paneles.

       El alto minimo evita que en una ventana baja los paneles queden de tres
       o cuatro filas; si no cabe, es la pantalla la que se desplaza. */
    .wave-process {
        flex: 1 1 auto;
        grid-auto-rows: minmax(0, 1fr);
        min-height: 520px;
    }

    .wave-process-host {
        overflow-y: auto;
    }

    .wave-process-panel .data-table-wrap,
    .wave-source-table {
        min-height: 0;
    }
}

@media (max-width: 980px) {
    .wave-process-panel .data-table-wrap,
    .wave-source-table {
        max-height: 60vh;
    }
}

/* Dialogo de impresion: mismo marco que el buscador, angosto porque son tres
   campos. Va despues de .picker-modal para poder acotarle el ancho. */
.print-modal {
    width: min(560px, 94vw);
}

.print-modal-body {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.print-modal-summary {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.print-modal-proceso {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.picker-header {
    align-items: center;
    background: #183556;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    padding: 14px 18px;
}

.picker-header h2 {
    font-size: 1.05rem;
    margin: 0;
}

.picker-close {
    background: transparent;
    border: 0;
    color: #ffffff;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0 4px;
}

.picker-close:hover {
    color: #f6c34b;
}

.picker-search {
    align-items: center;
    background: #f8fbff;
    border-bottom: 1px solid #d8e3f0;
    display: flex;
    gap: 10px;
    padding: 12px 18px;
}

.picker-search input {
    border: 1px solid #aeb8c5;
    border-radius: 2px;
    flex: 1 1 auto;
    min-height: 36px;
    padding: 6px 10px;
}

.picker-message {
    margin: 10px 18px 0;
}

.picker-results {
    flex: 1 1 auto;
    min-height: 160px;
    overflow: auto;
    overscroll-behavior: contain;
}

.picker-table {
    min-width: 100%;
}

.picker-table tbody tr {
    cursor: pointer;
}

.picker-footer {
    align-items: center;
    background: #f8fbff;
    border-top: 1px solid #d8e3f0;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px 18px;
}

.picker-footer > span {
    color: #35506f;
    font-size: 0.84rem;
    font-weight: 800;
}

/* Columna de seleccion de la grilla dinamica (Salidas) */
.select-col {
    text-align: center;
    width: 40px;
}

.select-col input[type="checkbox"] {
    /* Sin min-height la casilla hereda los 40px de los campos de texto y es
       ella, y no el relleno, la que fija el alto de la fila. */
    height: 16px;
    min-height: 16px;
    width: 16px;
}

/* Ayuda de columnas esperadas en las cargas de interfaces */
.load-hint {
    background: #f8fbff;
    border: 1px solid #d8e3f0;
    border-radius: 4px;
    color: #35506f;
    font-size: 0.82rem;
    padding: 10px 12px;
}

/* Barra de exportacion de la grilla dinamica */
.grid-export-bar {
    align-items: center;
    background: #f8fbff;
    border-bottom: 1px solid #d8e3f0;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 8px 14px;
}

.grid-export-bar > span {
    color: #35506f;
    font-size: 0.84rem;
    font-weight: 800;
}

.toolbar-right {
    align-items: center;
    display: flex;
    gap: 12px;
}

/* ============================================================
   Indicador global de actividad
   ------------------------------------------------------------
   Aparece con 350 ms de retardo: las respuestas rapidas no alcanzan
   a mostrarlo, y las lentas quedan a la vista sin lugar a dudas.
   ============================================================ */

.busy-veil {
    align-items: center;
    animation: busyAppear 160ms ease-out 350ms both;
    background: rgba(15, 34, 62, 0.28);
    display: flex;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 1300;
}

.busy-card {
    align-items: center;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 18px 48px rgba(15, 34, 62, 0.28);
    display: flex;
    gap: 14px;
    padding: 18px 26px;
}

.busy-card .busy-message {
    color: #0f223e;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
}

@keyframes busyAppear {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .busy-veil {
        animation-delay: 350ms;
        animation-duration: 1ms;
    }
}

/* Caja de filtro dinamico: estandar de todas las grillas. */
.grid-filter {
    align-items: center;
    display: flex;
    gap: 8px;
}

.grid-filter > span {
    color: #35506f;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.grid-filter input {
    background: #ffffff;
    border: 1px solid #c3d0e0;
    border-radius: 7px;
    color: #142033;
    font-family: inherit;
    font-size: 0.84rem;
    min-height: 32px;
    min-width: 220px;
    padding: 4px 10px;
}

.grid-filter input:focus {
    border-color: #2d6cdf;
    box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.16);
    outline: none;
}

.grid-export-bar .grid-count {
    color: #35506f;
    font-size: 0.84rem;
    font-weight: 800;
    margin-left: auto;
    white-space: nowrap;
}

/* Encabezado ordenable: estandar de todas las grillas. */
thead th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.data-table thead th.sortable:hover {
    background: rgba(255, 255, 255, 0.12);
}

.dash-table thead th.sortable:hover {
    color: #1d4ed8;
}

thead th.sortable > span {
    margin-right: 5px;
}

/* ============================================================
   Formularios: ancho por tipo de campo
   ------------------------------------------------------------
   Cada campo ocupa el ancho que su contenido necesita en lugar de
   estirarse a la columna completa. Se usa flex sin crecimiento para
   que un check o una fecha no queden del ancho de la pantalla.
   ============================================================ */

.maintenance-form-grid {
    align-items: flex-end;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
}

/* Anula la plantilla de columnas fija que traian los formularios. */
.client-form-grid {
    grid-template-columns: none;
}

.maintenance-form-grid > label,
.maintenance-form-grid > .field {
    display: grid;
    flex: 0 1 var(--field-width, 220px);
    gap: 5px;
    min-width: 0;
    width: var(--field-width, 220px);
}

.f-flag { --field-width: 132px; }
.f-num { --field-width: 128px; }
.f-date { --field-width: 158px; }
.f-code { --field-width: 168px; }
.f-sm { --field-width: 190px; }
.f-md { --field-width: 260px; }
.f-lg { --field-width: 340px; }
.f-xl { --field-width: 460px; }

.maintenance-form-grid > .f-full {
    --field-width: 100%;
    flex-basis: 100%;
}

/* Compatibilidad con el marcado anterior. */
.maintenance-form-grid > .span-2 { --field-width: 420px; }

/* La barra de edicion de detalle usa los mismos anchos. */
.detail-editor > label {
    display: grid;
    flex: 0 1 var(--field-width, 200px);
    gap: 5px;
    min-width: 0;
    width: var(--field-width, 200px);
}

/* Tipografia de etiqueta comun, tambien para los formularios aun sin <span>. */
.maintenance-form-grid > label,
.detail-editor > label,
.dashboard-filters > label {
    color: #10233f;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.field-label {
    align-items: baseline;
    color: #10233f;
    display: flex;
    font-size: 0.7rem;
    font-weight: 800;
    gap: 4px;
    letter-spacing: 0.05em;
    line-height: 1.3;
    text-transform: uppercase;
    white-space: nowrap;
}

.field-label .required-mark {
    color: #c2410c;
    font-weight: 900;
}

/* Controles: mismo alto y mismo foco para input, select y combo. */
.maintenance-form-grid input:not([type="checkbox"]),
.maintenance-form-grid select,
.maintenance-form-grid .search-select-input,
.detail-editor input:not([type="checkbox"]),
.detail-editor select,
.detail-editor .search-select-input,
.inline-field input:not([type="checkbox"]),
.inline-field select {
    background: #ffffff;
    border: 1px solid #c3d0e0;
    border-radius: 7px;
    color: #142033;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    min-height: 34px;
    padding: 5px 10px;
    transition: border-color 140ms ease, box-shadow 140ms ease;
    width: 100%;
}

.client-card .maintenance-form-grid input:not([type="checkbox"]),
.client-card .maintenance-form-grid select {
    border-radius: 7px;
    font-weight: 600;
    min-height: 34px;
}

.maintenance-form-grid input:focus,
.maintenance-form-grid select:focus,
.detail-editor input:focus,
.detail-editor select:focus,
.inline-field input:focus,
.search-select-input:focus {
    border-color: #2d6cdf;
    box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.16);
    outline: none;
}

.maintenance-form-grid input:disabled,
.maintenance-form-grid select:disabled,
.detail-editor input:disabled {
    background: #f1f4f9;
    color: #7c8aa0;
}

/* Boton que acompana a un campo dentro del formulario: se alinea con los
   controles de su fila, no con el texto de la etiqueta. */
.field-action .tool-button {
    justify-content: center;
    min-height: 34px;
    width: 100%;
}

/* Contador que acompana a esos botones: se centra con ellos, no con la base. */
.field-action .detail-hint {
    align-items: center;
    display: flex;
    min-height: 34px;
    white-space: nowrap;
}

/* Nota al final de una fila de campos: ocupa lo que dice, no un ancho fijo. */
.maintenance-form-grid > .field-note {
    flex: 0 0 auto;
    width: auto;
}

/* Campo bandera: casilla compacta, no una caja del ancho del formulario. */
.flag-control {
    align-items: center;
    background: #ffffff;
    border: 1px solid #c3d0e0;
    border-radius: 7px;
    display: flex;
    gap: 8px;
    min-height: 34px;
    padding: 5px 10px;
}

.flag-control input[type="checkbox"] {
    accent-color: #2d6cdf;
    height: 17px;
    margin: 0;
    /* Los formularios fijan min-height 36px para inputs; la casilla no debe heredarlo. */
    min-height: 0;
    width: 17px;
}

.flag-control .flag-text {
    color: #35506f;
    font-size: 0.82rem;
    font-weight: 700;
}

.flag-control:has(input:disabled) {
    background: #f1f4f9;
}

/* ============================================================
   Combo con filtrado al digitar
   ============================================================ */

.search-select {
    position: relative;
}

.search-select-input {
    cursor: text;
    padding-right: 28px !important;
    text-overflow: ellipsis;
}

.search-select-input.is-empty::placeholder {
    color: #94a3b8;
    font-weight: 500;
}

.search-select-caret {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #64748b;
    pointer-events: none;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-2px);
}

.search-select.is-disabled .search-select-caret {
    opacity: 0.4;
}

.search-select-list {
    background: #ffffff;
    border: 1px solid #c3d0e0;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 34, 62, 0.18);
    left: 0;
    list-style: none;
    margin: 4px 0 0;
    max-height: 280px;
    max-width: 420px;
    min-width: 100%;
    overflow-y: auto;
    padding: 4px;
    position: absolute;
    top: 100%;
    width: max-content;
    z-index: 41;
}

.search-select-option {
    border-radius: 5px;
    color: #1f2f47;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 7px 9px;
}

.search-select-option:hover {
    background: #eaf2ff;
}

/* La opcion marcada con las flechas se ve mas que la del puntero: es la que
   se toma al presionar Tab o Enter, asi que tiene que notarse cual es. */
.search-select-option.is-active {
    background: #d7e6ff;
    box-shadow: inset 3px 0 0 #1d4ed8;
}

.search-select-option.is-selected {
    color: #1d4ed8;
    font-weight: 800;
}

.search-select-option.is-empty-option {
    color: #64748b;
    font-style: italic;
}

.search-select-empty {
    color: #64748b;
    font-size: 0.84rem;
    padding: 10px 9px;
}

/* ============================================================
   Tablero de indicadores
   ============================================================ */

.dashboard-shell {
    display: grid;
    gap: 16px;
    padding: 18px 22px 28px;
}

.dashboard-filters {
    align-items: flex-end;
    background: #ffffff;
    border: 1px solid #dbe4ef;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 34, 62, 0.06);
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 14px 18px;
}

.dashboard-filters > label {
    display: grid;
    gap: 5px;
    width: var(--field-width, 200px);
}

.dashboard-filters input,
.dashboard-filters .search-select-input {
    background: #ffffff;
    border: 1px solid #c3d0e0;
    border-radius: 7px;
    color: #142033;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    min-height: 34px;
    padding: 5px 10px;
    width: 100%;
}

.dashboard-filters .range-buttons {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.range-button {
    background: #ffffff;
    border: 1px solid #c3d0e0;
    border-radius: 7px;
    color: #35506f;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    min-height: 34px;
    padding: 5px 12px;
}

.range-button:hover {
    background: #eef4ff;
}

.range-button.is-active {
    background: #183556;
    border-color: #183556;
    color: #ffffff;
}

.kpi-row {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.kpi-tile {
    background: #ffffff;
    border: 1px solid #dbe4ef;
    border-left: 4px solid #94a3b8;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 34, 62, 0.06);
    display: grid;
    gap: 4px;
    padding: 14px 16px;
}

.kpi-tile .kpi-label {
    color: #5b6b83;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.kpi-tile .kpi-value {
    color: #0f223e;
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.1;
}

.kpi-tile .kpi-foot {
    color: #64748b;
    font-size: 0.78rem;
}

.kpi-tile.tone-blue { border-left-color: #2d6cdf; }
.kpi-tile.tone-green { border-left-color: #16a34a; }
.kpi-tile.tone-amber { border-left-color: #d97706; }
.kpi-tile.tone-red { border-left-color: #dc2626; }
.kpi-tile.tone-violet { border-left-color: #7c3aed; }
.kpi-tile.tone-slate { border-left-color: #475569; }

.dashboard-columns {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.dash-card {
    background: #ffffff;
    border: 1px solid #dbe4ef;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 34, 62, 0.06);
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 16px 18px;
}

.dash-card > header {
    align-items: baseline;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.dash-card h2 {
    color: #0f223e;
    font-size: 0.98rem;
    font-weight: 800;
    margin: 0;
}

.dash-card .card-note {
    color: #64748b;
    font-size: 0.76rem;
}

.dash-card.span-all {
    grid-column: 1 / -1;
}

/* Barras de avance de un proceso */
.meter-list {
    display: grid;
    gap: 11px;
}

.meter-row {
    display: grid;
    gap: 4px;
}

.meter-head {
    display: flex;
    font-size: 0.81rem;
    gap: 10px;
    justify-content: space-between;
}

.meter-head .meter-name {
    color: #35506f;
    font-weight: 700;
}

.meter-head .meter-figure {
    color: #0f223e;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    white-space: nowrap;
}

.meter-track {
    background: #e8eef7;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.meter-track > i {
    background: #2d6cdf;
    border-radius: 999px;
    display: block;
    height: 100%;
    transition: width 240ms ease;
}

.meter-row.tone-green .meter-track > i { background: #16a34a; }
.meter-row.tone-amber .meter-track > i { background: #d97706; }
.meter-row.tone-red .meter-track > i { background: #dc2626; }
.meter-row.tone-violet .meter-track > i { background: #7c3aed; }

/* Serie diaria */
.spark-chart {
    align-items: flex-end;
    display: flex;
    gap: 3px;
    height: 140px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.spark-day {
    align-items: flex-end;
    display: flex;
    flex: 0 0 auto;
    gap: 1px;
    height: 100%;
    width: 14px;
}

.spark-day > i {
    border-radius: 2px 2px 0 0;
    display: block;
    flex: 1 1 0;
    min-height: 2px;
}

.spark-day > i.bar-in { background: #2d6cdf; }
.spark-day > i.bar-out { background: #16a34a; }

.spark-legend {
    color: #5b6b83;
    display: flex;
    font-size: 0.78rem;
    gap: 16px;
}

.spark-legend span {
    align-items: center;
    display: flex;
    gap: 6px;
}

.spark-legend i {
    border-radius: 2px;
    display: block;
    height: 10px;
    width: 10px;
}

/* Tabla compacta dentro de una tarjeta */
.dash-table {
    border-collapse: collapse;
    font-size: 0.82rem;
    width: 100%;
}

.dash-table th {
    border-bottom: 1px solid #dbe4ef;
    color: #5b6b83;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    padding: 6px 8px;
    text-align: left;
    text-transform: uppercase;
}

.dash-table td {
    border-bottom: 1px solid #eef2f8;
    color: #1f2f47;
    padding: 7px 8px;
}

.dash-table td.numeric {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.dash-table .material-name {
    color: #5b6b83;
    display: block;
    font-size: 0.76rem;
}

.dash-empty {
    color: #64748b;
    font-size: 0.85rem;
    padding: 10px 0;
}

@media (max-width: 720px) {
    .maintenance-form-grid > label,
    .maintenance-form-grid > .field,
    .dashboard-filters > label {
        --field-width: 100%;
        flex-basis: 100%;
    }

    .dashboard-filters .range-buttons {
        margin-left: 0;
    }
}

/* ============================================================
   Documento de entrega (REPORTE_ORDENWMS_SALIDA)
   Se ve igual en la ventana de vista previa y en el papel: la hoja se define
   una sola vez y el bloque de impresion solo ajusta margenes y colores.
   ============================================================ */

.entrega-modal {
    max-height: min(880px, 92vh);
    width: min(1000px, 96vw);
}

.entrega-hoja {
    background: #6b7688;
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 18px;
}

.entrega-cargando {
    color: #ffffff;
    font-weight: 700;
    text-align: center;
}

.entrega-doc {
    background: #ffffff;
    color: #10233f;
    display: block;
    font-size: 12px;
    margin: 0 auto;
    max-width: 820px;
    padding: 26px 30px;
}

.entrega-titulo {
    align-items: center;
    border-bottom: 2px solid #10233f;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    padding-bottom: 10px;
}

.entrega-titulo h1 {
    font-size: 17px;
    font-weight: 800;
    margin: 0;
}

.entrega-barras {
    display: block;
    margin-left: auto;
}

.entrega-barras-texto {
    display: block;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 11px;
    letter-spacing: 1px;
    text-align: right;
}

.entrega-datos {
    display: grid;
    gap: 6px 18px;
    grid-template-columns: repeat(3, 1fr);
    margin: 14px 0;
}

.entrega-campo {
    border-bottom: 1px solid #d5dde8;
    display: grid;
    gap: 1px;
    padding-bottom: 4px;
}

.entrega-campo span {
    color: #55637a;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.entrega-campo strong {
    font-size: 12px;
    font-weight: 700;
    word-break: break-word;
}

.entrega-observaciones {
    border: 1px solid #d5dde8;
    margin-bottom: 14px;
    padding: 8px 10px;
}

.entrega-observaciones h2 {
    color: #55637a;
    font-size: 10px;
    font-weight: 700;
    margin: 0 0 4px;
    text-transform: uppercase;
}

.entrega-observaciones p {
    margin: 0;
    white-space: pre-wrap;
}

.entrega-detalle {
    border-collapse: collapse;
    width: 100%;
}

.entrega-detalle th,
.entrega-detalle td {
    border-bottom: 1px solid #d5dde8;
    padding: 5px 6px;
    text-align: left;
    vertical-align: top;
}

.entrega-detalle thead th {
    border-bottom: 1.5px solid #10233f;
    font-size: 10px;
    text-transform: uppercase;
}

.entrega-detalle .num {
    text-align: right;
    white-space: nowrap;
}

.entrega-detalle tfoot td {
    border-bottom: none;
    border-top: 1.5px solid #10233f;
    font-weight: 800;
}

.entrega-detalle tfoot td:first-child {
    text-align: right;
}

/* Las cuatro casillas que se llenan a mano al recibir la mercaderia. */
.entrega-firma {
    display: grid;
    gap: 26px 40px;
    grid-template-columns: 1fr 1fr;
    margin-top: 46px;
}

.entrega-firma div {
    display: grid;
    gap: 4px;
}

.entrega-firma span {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.entrega-firma i {
    border-bottom: 1px solid #10233f;
    display: block;
    height: 26px;
}

.entrega-pie {
    color: #55637a;
    font-size: 10px;
    margin-top: 18px;
    text-align: right;
}

/* El marco de impresion carga la misma hoja de estilos: aqui solo se quita el
   fondo de la vista previa y se fija el tamano del papel. */
@page {
    /* 5 mm parejo: es el borde que casi ninguna impresora laser o de tinta
       alcanza a imprimir, asi que el documento nunca queda cortado. El margen
       va aqui y no en el documento porque @page se aplica a todas las hojas,
       tambien a la segunda y siguientes. */
    margin: 5mm;
    size: A4 portrait;
}

body.entrega-print {
    background: #ffffff;
    margin: 0;
}

body.entrega-print .entrega-doc {
    max-width: none;
    padding: 0;
}

@media print {
    /* El encabezado de la tabla se repite en cada hoja y no se parte una fila. */
    .entrega-detalle thead {
        display: table-header-group;
    }

    .entrega-detalle tr {
        break-inside: avoid;
    }

    .entrega-firma {
        break-inside: avoid;
    }
}

/* ============================================================
   Paginado de grillas (estandar desde la 2.0.0)
   ------------------------------------------------------------
   Barra debajo de la tabla. En los paneles de alto completo queda
   fija al pie: la tabla es la que se desplaza.
   ============================================================ */

.grid-pager {
    align-items: center;
    background: #f8fbff;
    border-top: 1px solid #d8e3f0;
    color: #35506f;
    display: flex;
    flex: none;
    flex-wrap: wrap;
    font-size: 0.8rem;
    gap: 8px 18px;
    justify-content: space-between;
    padding: 6px 14px;
}

.grid-pager-nav {
    align-items: center;
    display: flex;
    gap: 4px;
}

.pager-button {
    background: #ffffff;
    border: 1px solid #c3d0e0;
    border-radius: 6px;
    color: #1d3a5f;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 800;
    height: 28px;
    line-height: 1;
    min-height: 28px;
    min-width: 30px;
    padding: 0 8px;
}

.pager-button:hover:not(:disabled) {
    background: #e8f0fb;
    border-color: #8fb0d8;
}

.pager-button:disabled {
    color: #aab6c6;
    cursor: default;
}

.pager-page {
    align-items: center;
    display: inline-flex;
    font-weight: 700;
    gap: 6px;
    margin: 0 6px;
    white-space: nowrap;
}

.pager-page input {
    border: 1px solid #c3d0e0;
    border-radius: 6px;
    font: inherit;
    font-weight: 800;
    height: 28px;
    min-height: 28px;
    padding: 0 4px;
    text-align: center;
    width: 68px;
}

.grid-pager-size {
    align-items: center;
    display: inline-flex;
    gap: 8px;
}

.grid-pager-size > span {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.grid-pager-size select {
    border: 1px solid #c3d0e0;
    border-radius: 6px;
    font: inherit;
    font-weight: 800;
    height: 28px;
    min-height: 28px;
    padding: 0 6px;
    width: auto;
}

.grid-pager-range {
    font-weight: 800;
    white-space: nowrap;
}

/* Con paginado, la casilla del encabezado marca solo la pagina; este aviso
   ofrece extender la marca a todas las filas filtradas. */
.select-all-notice {
    align-items: center;
    background: #fff8e1;
    border-bottom: 1px solid #f0d98a;
    color: #5c4400;
    display: flex;
    flex: none;
    flex-wrap: wrap;
    font-size: 0.82rem;
    font-weight: 700;
    gap: 10px;
    justify-content: center;
    padding: 6px 14px;
}

.select-all-notice .link-button {
    background: none;
    border: 0;
    color: #1d4ed8;
    cursor: pointer;
    font: inherit;
    min-height: 0;
    padding: 0;
    text-decoration: underline;
}

/* ============================================================
   Pestañas de pantallas (desde la 2.1.0)
   ------------------------------------------------------------
   Cada opcion del menu se abre como pestaña, como en el escritorio.
   Las pantallas abiertas siguen vivas: solo se muestra la activa.
   ============================================================ */

.app-tabs {
    align-items: flex-end;
    background: #eef3f9;
    border-bottom: 1px solid #c9d6e6;
    display: flex;
    flex: none;
    gap: 3px;
    overflow-x: auto;
    padding: 6px 12px 0;
    scrollbar-width: thin;
}

.app-tab {
    align-items: center;
    background: #dde6f1;
    border: 1px solid #c9d6e6;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    display: flex;
    flex: none;
    margin-bottom: -1px;
    max-width: 240px;
}

.app-tab:hover {
    background: #e8eef7;
}

.app-tab.is-active {
    background: #ffffff;
    border-color: #c9d6e6;
    box-shadow: inset 0 3px 0 #087f70;
}

.app-tab-title {
    background: none;
    border: 0;
    color: #4a607c;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    min-height: 32px;
    overflow: hidden;
    padding: 6px 8px 6px 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-tab.is-active .app-tab-title {
    color: #0f223e;
}

.app-tab-close {
    background: none;
    border: 0;
    border-radius: 4px;
    color: #6b7d95;
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
    margin-right: 6px;
    min-height: 0;
    padding: 2px 5px;
}

.app-tab-close:hover {
    background: #fde2e2;
    color: #b91c1c;
}

.app-tabs-count {
    color: #6b7d95;
    font-size: 0.72rem;
    font-weight: 800;
    margin-left: auto;
    padding: 0 4px 9px 12px;
    white-space: nowrap;
}

/* Aviso de por que no se abrio una pantalla: sin permiso, tope o direccion inexistente. */
.app-tab-notice {
    align-items: center;
    background: #fff4e5;
    border-bottom: 1px solid #f3c98b;
    color: #7a4a00;
    display: flex;
    flex: none;
    font-size: 0.84rem;
    font-weight: 700;
    gap: 12px;
    justify-content: space-between;
    padding: 8px 16px;
}

.app-tab-notice-close {
    background: none;
    border: 0;
    color: #7a4a00;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    min-height: 0;
    padding: 2px 6px;
}

.app-tab-checking {
    flex: 1 1 auto;
}

/* La pestaña oculta sigue en la pagina, pero sin ocupar lugar ni recibir el foco. */
.app-tab-page[hidden] {
    display: none !important;
}

/* En escritorio cada pestaña toma el alto sobrante, como antes lo tomaba la
   pantalla, para que su grilla siga desplazandose por dentro. */
@media (min-width: 981px) {
    .app-tab-page {
        display: flex;
        flex: 1 1 auto;
        flex-direction: column;
        min-height: 0;
    }
}

/* Linea de orden de salida a la que le falta un dato que su material exige */
.status-warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 999px;
    color: #b45309;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 10px;
    white-space: nowrap;
}

/* Aviso de instalacion del agente de impresion local */
.agent-install-panel {
    background: #fff8e6;
    border: 1px solid #f0d58c;
    border-radius: 4px;
    color: #5c4a14;
    display: grid;
    font-size: 0.85rem;
    gap: 8px;
    padding: 12px;
}

.agent-install-panel p,
.agent-install-panel ol {
    margin: 0;
}

.agent-install-panel ol {
    padding-left: 18px;
}

.agent-install-wait {
    align-items: center;
    display: flex;
    gap: 8px;
}

/* [v2.14.4] Errores por linea en las cargas del Menu Interfaces. */
.error-alert .load-errors {
    margin: 6px 0 0;
    padding-left: 20px;
    max-height: 260px;
    overflow-y: auto;
}

/* =====================================================================
   Gestion Entregas: mapa y fotografias de la entrega (v2.32.0)
   ===================================================================== */
.ge-backdrop { backdrop-filter: blur(3px); }

.ge-modal {
    display: flex;
    flex-direction: column;
    width: min(1180px, 100%);
    max-height: calc(100vh - 48px);
    overflow: hidden;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 30px 80px -20px rgba(7, 19, 41, 0.6);
    animation: ge-in 220ms ease both;
}

.ge-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 18px 22px;
    color: #ffffff;
    background: linear-gradient(120deg, #0f223e 0%, #183f78 60%, #2563eb 100%);
}

.ge-kicker { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.75; }
.ge-head h2 { margin: 2px 0 6px; font-size: 1.3rem; font-weight: 800; }
.ge-head p { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: 0.82rem; opacity: 0.9; }
.ge-head p b { color: #fcd34d; }

.ge-head-actions { display: flex; align-items: center; gap: 10px; }
.ge-head-actions .tool-button { text-decoration: none; }

.ge-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.ge-close:hover { background: rgba(255, 255, 255, 0.22); }

.ge-body {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 16px;
    min-height: 0;
    padding: 16px;
    overflow: auto;
    background: #f3f6fb;
}

.ge-map {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    border: 1px solid #dbe4ef;
    border-radius: 14px;
    background: #e5ebf3;
}

.ge-map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.ge-coord {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(15, 34, 62, 0.82);
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ge-photos {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    padding: 14px;
    border: 1px solid #dbe4ef;
    border-radius: 14px;
    background: #ffffff;
}

.ge-photos-head { display: flex; justify-content: space-between; align-items: baseline; color: #0f223e; }
.ge-photos-head span { color: #5b6b83; font-size: 0.78rem; }

.ge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    overflow-y: auto;
    max-height: 520px;
    padding-right: 2px;
}

.ge-thumb {
    position: relative;
    display: block;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    padding: 0;
    border: 1px solid #dbe4ef;
    border-radius: 12px;
    background: #eef2f8;
    cursor: zoom-in;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.ge-thumb:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -16px rgba(15, 34, 62, 0.6); }
.ge-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ge-thumb span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 8px 6px;
    background: linear-gradient(0deg, rgba(7, 19, 41, 0.78), transparent);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: left;
}

.ge-thumb.is-broken {
    display: grid;
    place-items: center;
    cursor: default;
    border-style: dashed;
    background: repeating-linear-gradient(135deg, #f5f7fb 0 10px, #eef2f8 10px 20px);
}

.ge-thumb.is-broken img { display: none; }
.ge-thumb.is-broken span { position: static; padding: 10px; background: none; color: #5b6b83; text-align: center; }
.ge-thumb.is-broken:hover { transform: none; box-shadow: none; }

.ge-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 160px;
    color: #5b6b83;
    font-size: 0.86rem;
    text-align: center;
}

.ge-error { color: #b91c1c; }

/* Visor de una foto a pantalla completa. */
.ge-viewer {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: grid;
    place-items: center;
    padding: 48px 72px;
    background: rgba(5, 11, 22, 0.92);
    animation: ge-in 160ms ease both;
}

.ge-viewer img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }

.ge-nav {
    position: absolute;
    top: 50%;
    width: 48px;
    height: 48px;
    transform: translateY(-50%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
}

.ge-nav:hover { background: rgba(255, 255, 255, 0.2); }
.ge-prev { left: 16px; }
.ge-next { right: 16px; }
.ge-viewer-close { position: absolute; top: 14px; right: 16px; }
.ge-viewer-count { position: absolute; top: 20px; left: 20px; color: #cbd5e1; font-size: 0.85rem; font-weight: 700; }
.ge-viewer-open { position: absolute; bottom: 16px; color: #93c5fd; font-size: 0.82rem; font-weight: 700; }

@keyframes ge-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
    .ge-body { grid-template-columns: 1fr; }
    .ge-map { min-height: 300px; }
    .ge-viewer { padding: 48px 12px; }
}
