/* ============================================================
   ROOT - Variables
   ============================================================ */
:root {
    /* Colores base */
    --navy: #0D2B5C;
    --navy2: #1A3D7A;
    --amber: #FFB300;
    --amber2: #FFC62B;
    --green: #1B7340;
    --green2: #22914F;
    --gfill: #D4EDDA;
    --red: #C0392B;
    --rfill: #FDECEA;
    --blue: #1565C0;
    --bfill: #DBEAFE;
    --teal: #006E7A;
    --tfill: #E0F7FA;
    --orange: #E65100;
    --ofill: #FFF3E0;
    --vb: #795548;
    --vfill: #EFEBE9;
    --nn: #C62828;
    --nnfill: #FCE4EC;
    --purple: #4A148C;
    --pfill: #EDE7F6;
    --gold: #7B5800;
    --gdfill: #FFF9C4;
    --muted: #6B7BA4;
    --border: #D0DAF0;
    --text: #1A1A2E;
    --bg: #EEF3FB;
    --card: #fff;
    --input: #F4F7FF;
    --gold-light: #FFF8E1;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(13, 43, 92, 0.08);
    --shadow-header: 0 4px 20px rgba(13, 43, 92, 0.3);
}

/* ============================================================
   RESET BASE
   ============================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Barlow', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-top: 0;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   HEADER - UNIFICADO
   ============================================================ */
header {
    position: sticky;
    top: 0;
    z-index: 3000;
    background: linear-gradient(135deg, #0b1a33 0%, #1a2f4e 100%);
    padding: 0.3rem 1.8rem;
    border-bottom: 3px solid var(--amber);
    width: 100%;
    box-sizing: border-box;
}

.hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* --- LOGO --- */
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: transparent;
    clip-path: none;
    padding: 0;
    border-radius: 0;
}

.logo img {
    height: 40px;
    width: auto;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

.logo img:hover {
    transform: scale(1.03);
}

.logo-n {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: 1px;
    color: #ffffff;
    padding-left: 0.5rem;
}

.logo-nn {
    --tw-text-opacity: 1;
    color: rgb(100 116 139 / var(--tw-text-opacity, 1));
    color: #ffffff;
    padding-left: 0.5rem;
}

/* --- ACCIONES HEADER --- */
.hdr-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    padding-right: 0;
}

.version-badge {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(4px);
    color: #b6d0f0;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3rem 0.9rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: 0.5px;
}

.hdr-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #d6e4ff;
    width: 40px;
    height: 40px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.hdr-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.hdr-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.2;
}

/* ============================================================
   NAV / TABS - UNIFICADO
   ============================================================ */
.nav-scroll {
    padding: 0 0.2rem 0 0;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    background: transparent;
    border-top: none;
}

.nav-scroll::-webkit-scrollbar {
    height: 3px;
}

.nav-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.nav-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 20px;
}

.tabs {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 1.8rem 0 0 0;
    flex-wrap: nowrap;
    min-width: max-content;
    justify-content: flex-start;
}

/* --- TABS BASE --- */
.tab {
    background: transparent;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 8px 8px 0 0;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 1px solid transparent;
    font-family: inherit;
    border-bottom: none;
    text-transform: none;
    letter-spacing: normal;
}

.tab:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.06);
    transform: none;
}

.tab.on {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab.on::after {
    display: none;
}

.tab .tab-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.tab .tab-label {
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

/* ============================================================
   DROPDOWN MENUS - UNIFICADO
   ============================================================ */
.tab-dropdown {
    position: relative;
}

.tab-dropdown-btn {
    padding-right: 0.6rem;
    position: relative;
}

.dropdown-arrow {
    font-size: 0.65rem;
    margin-left: 0.15rem;
    opacity: 0.6;
    transition: transform 0.2s ease;
    position: relative;
    right: auto;
    top: auto;
    transform: none;
}

.tab-dropdown-btn[aria-expanded="true"] .dropdown-arrow,
.tab-dropdown-btn.open .dropdown-arrow {
    transform: rotate(180deg);
    opacity: 0.9;
}

/* --- MENÚ DESPLEGABLE --- */
.dropdown-menu {
    position: fixed;
    top: auto;
    left: auto;
    min-width: 200px;
    background: #ffffff;
    padding: 0.5rem;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.04);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: block;
    border-top: none;
    animation: none;
}

.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    text-align: left;
}

.dropdown-item:hover {
    background: #f1f5f9;
    color: #0b1a33;
}

.dropdown-item.active {
    background: #e6edf8;
    color: #0b1a33;
    font-weight: 600;
}

.dropdown-item .dropdown-icon {
    font-size: 1.1rem;
    width: 1.6rem;
    text-align: center;
}

.dropdown-item .dropdown-badge {
    display: none;
}

.dropdown-submenu {
    position: relative;
}

.dropdown-submenu-toggle {
    justify-content: flex-start;
}

.dropdown-submenu-arrow {
    margin-left: auto;
    font-size: 1rem;
}

.dropdown-submenu-menu {
    position: absolute;
    top: -0.5rem;
    left: calc(100% + 0.35rem);
    min-width: 180px;
    padding: 0.5rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 8px;
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
    transition: all 0.2s ease;
    z-index: 10001;
}

.dropdown-submenu-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

@media (max-width: 720px) {
    .dropdown-submenu-menu {
        position: static;
        margin-left: 1rem;
        box-shadow: none;
        border: 0;
        transform: none;
    }
}

.dropdown-divider {
    display: none;
}

/* ============================================================
   MAIN
   ============================================================ */
main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 20px 12px 80px;
    width: 100%;
    flex: 1 0 auto;
}

/* Footer al fondo cuando hay poco contenido, sin cubrir el contenido al hacer scroll. */
.site-footer {
    width: 100%;
    flex: 0 0 auto;
    margin-top: auto !important;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

.sec {
    display: none;
    animation: fadeIn 0.3s ease;
}

.sec.on {
    display: block;
}

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

/* ============================================================
   INFOKBOX
   ============================================================ */
.infobox {
    background: var(--navy);
    border-radius: 10px;
    padding: 13px 16px;
    margin-bottom: 12px;
    display: flex;
    gap: 11px;
}

.infobox .ico {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 1px;
}

.infobox h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: #FFD166;
    margin: 0 0 5px;
}

.infobox p {
    font-size: 12px;
    margin: 0;
    color: rgba(255, 255, 255, 0.90);
}

.infobox ol {
    padding-left: 16px;
    margin: 0;
}

.infobox li {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.90);
    line-height: 1.65;
}

.infobox li strong {
    color: #fff;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(13, 43, 92, 0.05);
    overflow: hidden;
    margin-bottom: 13px;
}

.card-hdr {
    background: var(--navy);
    padding: 11px 18px;
    display: flex;
    align-items: center;
    gap: 9px;
}

.card-hdr .ico {
    font-size: 15px;
}

.card-hdr h2 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--amber);
}

.card-hdr p {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 1px;
}

.card-hdr-r {
    margin-left: auto;
}

.card-body {
    padding: 15px 18px;
}

.card.c-gas .card-hdr {
    background: linear-gradient(90deg, #BF360C 0%, var(--orange) 100%);
}

.card.c-km .card-hdr {
    background: linear-gradient(90deg, #004D57 0%, var(--teal) 100%);
}

/* ============================================================
   GRIDS
   ============================================================ */
.g2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px 14px;
}

.g3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 11px 14px;
}

.g4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 11px 14px;
}

.g5 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 11px 14px;
}

.s2 {
    grid-column: span 2;
}

.s3 {
    grid-column: span 3;
}

.s4 {
    grid-column: span 4;
}

.s5 {
    grid-column: span 5;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.f {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.f label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.req {
    color: var(--amber);
}

.tag {
    display: inline-block;
    font-size: 7.5px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
    letter-spacing: 0.4px;
}

.tag.auto {
    background: var(--bfill);
    color: var(--blue);
    border: 1px solid #90CAF9;
}

.tag.opt {
    background: #F3E5F5;
    color: #6A1B9A;
    border: 1px solid #CE93D8;
}

input,
select {
    font-family: 'Barlow', sans-serif;
    font-size: 13px;
    padding: 8px 11px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    background: var(--input);
    color: var(--text);
    transition: all 0.14s;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

input:focus,
select:focus {
    border-color: var(--navy);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(13, 43, 92, 0.07);
}

.ai {
    background: var(--bfill) !important;
    border-color: #90CAF9 !important;
    color: var(--blue) !important;
    font-weight: 700;
}

.ag {
    background: var(--gfill) !important;
    border-color: var(--green) !important;
    color: var(--green) !important;
    font-weight: 700;
}

.ay {
    background: var(--gdfill) !important;
    border-color: #E6B800 !important;
    color: var(--gold) !important;
    font-weight: 700;
}

.ar {
    background: var(--rfill) !important;
    border-color: var(--red) !important;
    color: var(--red) !important;
    font-weight: 700;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7BA4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-row {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.btn {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 9px 18px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.14s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bn {
    background: var(--navy);
    color: var(--amber);
}

.bn:hover {
    background: var(--navy2);
}

.bg {
    background: var(--green);
    color: #fff;
}

.bg:hover {
    background: var(--green2);
}

.ba {
    background: var(--amber);
    color: var(--navy);
}

.ba:hover {
    background: var(--amber2);
}

.bc {
    background: transparent;
    color: var(--muted);
    border: 1.5px solid var(--border);
}

.bc:hover {
    border-color: var(--red);
    color: var(--red);
}

.bt {
    background: var(--teal);
    color: #fff;
}

.bt:hover {
    filter: brightness(1.1);
}

.bv {
    background: var(--vb);
    color: #fff;
}

.bnn {
    background: var(--nn);
    color: #fff;
}

.bcp {
    background: var(--amber);
    color: var(--navy);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn.c {
    background: var(--red);
    color: #fff;
}

.m-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    background: #fff;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Barlow', sans-serif;
}

.m-btn:hover {
    border-color: var(--navy);
}

.m-btn.on {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

/* ============================================================
   OUTPUT PANEL
   ============================================================ */
.out-panel {
    margin-top: 13px;
    display: none;
}

.out-panel.visible {
    display: block;
}

.out-tab-bar {
    display: flex;
    gap: 3px;
}

.out-tab {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 6px 14px 8px;
    border: 1.5px solid var(--border);
    background: var(--input);
    color: var(--muted);
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    border-bottom: none;
    transition: all 0.13s;
}

.out-tab.on {
    background: var(--amber);
    color: var(--navy);
    border-color: var(--amber);
}

.out-body {
    background: var(--card);
    border: 1.5px solid var(--amber);
    border-radius: 0 8px 8px 8px;
    padding: 15px;
}

.out-body.solo {
    border-radius: 8px;
    border-color: var(--teal);
    margin-top: 8px;
}

.out-sec {
    display: none;
}

.out-sec.on {
    display: block;
}

.out-row {
    background: #F4F7FF;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: 9px 12px;
    font-family: 'Courier New', monospace;
    font-size: 10.5px;
    color: var(--text);
    word-break: break-all;
    white-space: pre-wrap;
    line-height: 1.8;
    margin-bottom: 5px;
    border-left: 4px solid var(--green);
}

.out-row.ov {
    border-left-color: var(--vb);
}

.out-row.on2 {
    border-left-color: var(--nn);
}

.out-row.ot {
    border-left-color: var(--teal);
}

.out-row.op {
    border-left-color: var(--purple);
}

.out-lbl {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin: 8px 0 3px;
}

.out-guide {
    font-size: 10px;
    color: var(--muted);
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 12px;
    line-height: 1.65;
    margin-bottom: 11px;
}

.out-guide strong {
    color: var(--navy);
}

.out-block {
    background: #fff;
    border-radius: var(--radius);
    border: 2px solid var(--green);
    padding: 16px;
    margin-top: 16px;
}

.out-title {
    font-weight: 700;
    color: var(--navy);
    font-size: 14px;
    margin-bottom: 10px;
}

.out-rows .out-row {
    margin-bottom: 4px;
}

/* ============================================================
   RES BAR
   ============================================================ */
.res-bar {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
    border-radius: 11px;
    padding: 13px 16px;
    margin-bottom: 12px;
}

.res-bar h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--amber);
    margin-bottom: 9px;
}

.res-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 7px;
}

.rb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rb .rl {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.80);
    text-transform: uppercase;
}

.rb .rv {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-top: 2px;
}

.rb.hi .rv {
    color: var(--amber);
    font-size: 19px;
}

/* ============================================================
   HI (Historial Items)
   ============================================================ */
.hi {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 13px;
    margin-bottom: 7px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.hi-badge {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 11px;
    background: var(--navy);
    color: var(--amber);
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.hi-info {
    flex: 1;
}

.hi-info .m {
    font-weight: 600;
    font-size: 12px;
}

.hi-info .s {
    font-size: 10.5px;
    color: var(--muted);
    margin-top: 1px;
}

.hi-cp {
    font-size: 9.5px;
    font-weight: 600;
    color: var(--teal);
    border: 1px solid var(--teal);
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
}

.hi-cp:hover {
    background: var(--teal);
    color: #fff;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
    text-align: center;
    padding: 28px;
    color: var(--muted);
    font-size: 12px;
}

.empty span {
    font-size: 28px;
    display: block;
    margin-bottom: 6px;
}

/* ============================================================
   TOAST
   ============================================================ */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--navy);
    color: #fff;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 13px;
    padding: 10px 24px;
    border-radius: 40px;
    box-shadow: 0 6px 22px rgba(13, 43, 92, 0.35);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    z-index: 6000;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

#toast.on {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

#toast.success {
    background: var(--green);
    box-shadow: 0 6px 22px rgba(27, 115, 64, 0.35);
}

#toast.error {
    background: var(--red);
    box-shadow: 0 6px 22px rgba(192, 57, 43, 0.35);
}

#toast.warning {
    background: var(--orange);
    box-shadow: 0 6px 22px rgba(230, 81, 0, 0.35);
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13, 43, 92, 0.92);
    z-index: 9999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: 'Barlow Condensed', sans-serif;
}

#loading-overlay.active {
    display: flex;
}

#loading-overlay .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid var(--amber);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

#loading-overlay p {
    margin-top: 16px;
    font-size: 16px;
    letter-spacing: 1px;
}

/* ============================================================
   MAESTROS / CRUDO / COMPLETAR
   ============================================================ */
.m-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.m-panel {
    display: none;
    animation: fadeIn 0.25s;
}

.m-panel.on {
    display: block;
}

.m-form {
    background: #F4F6FB;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 18px;
    border: 1px solid #E0E6F0;
}

.m-form h4 {
    margin: 0 0 14px;
    color: #0D2B5C;
    font-size: 15px;
}

.m-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.m-grid input,
.m-grid select {
    padding: 8px 10px;
    border: 1.5px solid #CBD5E0;
    border-radius: 7px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}

.m-grid input:focus,
.m-grid select:focus {
    border-color: #FFB300;
    outline: none;
}

.m-add-btn {
    background: #1B7340;
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.m-add-btn:hover {
    background: #145c32;
}

.maestro-section-box {
    align-items: center;
    justify-content: space-between;
}

.maestro-section-copy {
    flex: 1;
}

.maestro-section-box .m-add-btn {
    flex-shrink: 0;
    margin-left: 16px;
}

.m-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 8px;
}

.m-filter-row label {
    color: #6B7BA4;
    font-size: 12px;
    font-weight: 700;
}

.m-filter-row select {
    max-width: 25%;
    padding: 7px 10px;
    border: 1px solid #C8D0E0;
    border-radius: 6px;
    color: #0D2B5C;
    background: #fff;
    font-size: 13px;
}

.m-km-btn {
    margin-left: 5px;
    background: #0D2B5C;
}

.m-km-btn:hover {
    background: #081d40;
}

.km-unidad-modal-rows {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 58vh;
    overflow-y: auto;
}

.km-unidad-header-id {
    min-width: 130px;
    margin-left: auto;
    padding: 8px 14px;
    border: 1px solid rgba(255, 209, 102, .55);
    border-radius: 9px;
    background: rgba(255, 209, 102, .12);
    text-align: center;
}

.km-unidad-header-id span {
    display: block;
    color: #FFD166;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

.km-unidad-header-id strong {
    display: block;
    margin-top: 2px;
    color: #fff;
    font-size: 18px;
    letter-spacing: .5px;
}

.km-unidad-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 16px;
    padding: 4px 16px;
    align-items: center;
}

.km-unidad-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.km-unidad-field span {
    color: #52617d;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .35px;
    text-transform: uppercase;
}

.km-unidad-field input,
.km-unidad-field select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 11px 12px;
    border: 1.5px solid #C8D0E0;
    border-radius: 8px;
    background: #fff;
    color: #0D2B5C;
    font-size: 13px;
}

.km-unidad-field input:focus,
.km-unidad-field select:focus {
    outline: none;
    border-color: #0D2B5C;
    box-shadow: 0 0 0 3px rgba(13, 43, 92, .1);
}

.km-unidad-field-wide {
    grid-column: 1 / -1;
}

@media (max-width: 700px) {
    .km-unidad-header-id {
        min-width: 100px;
        margin-left: 0;
        padding: 6px 10px;
    }

    .km-unidad-row {
        grid-template-columns: 1fr 1fr;
        gap: 14px 10px;
    }
}

@media (max-width: 700px) {
    .maestro-section-box {
        align-items: flex-start;
    }

    .maestro-section-box .m-add-btn {
        margin: 8px 0 0;
    }
}

.m-count {
    font-size: 12px;
    color: #6B7BA4;
    margin-bottom: 8px;
}

.m-empty {
    color: #999;
    font-style: italic;
    padding: 16px;
    text-align: center;
}

.m-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 12px;
}

.m-table th {
    background: #0D2B5C;
    color: #FFB300;
    padding: 8px 10px;
    text-align: left;
}

.m-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #E0E6F0;
}

.m-table tr:nth-child(even) td {
    background: #F4F6FB;
}

.m-del {
    background: #C0392B;
    color: #fff;
    border: none;
    padding: 3px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
}

.m-edit {
    background: var(--navy);
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.m-edit:hover {
    background: var(--navy2);
}

.m-driver-trips-btn {
    background: #1B7340;
    margin-left: 4px;
}

.driver-trips-modal {
    width: min(920px, 100%) !important;
    height: calc(100vh - 36px);
    max-height: calc(100vh - 36px);
    padding: 5px !important;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden
}

.driver-trips-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.driver-trips-header h3 {
    margin: 0;
    color: #0D2B5C;
    font-size: 18px;
}

.driver-trips-header p {
    margin: 4px 0 0;
    color: #6B7BA4;
    font-size: 12px;
}

.driver-trips-close {
    background: #0D2B5C;
    color: #fff;
}

.driver-trips-close:hover {
    background: #1B7340;
}

.driver-trips-filters {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px;
    margin-bottom: 14px;
    background: #F4F6FB;
    border: 1px solid #E0E6F0;
    border-radius: 8px;
}

.driver-trips-filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #555;
    font-size: 11px;
    font-weight: 700;
}

.driver-trips-filters input {
    padding: 7px 9px;
    border: 1px solid #C8D0E0;
    border-radius: 6px;
    color: #0D2B5C;
}

.driver-trips-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.driver-trips-current-month {
    background: #1565C0;
}

.driver-trips-summary {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #0D2B5C;
    color: #fff;
    font-size: 12px;
}

.driver-trips-summary strong {
    margin-right: auto;
    color: #FFB300;
}

.driver-trips-summary b {
    color: #FFB300;
    font-size: 14px;
}

.driver-trip-status {
    display: inline-block;
    padding: 3px 7px;
    border-radius: 10px;
    background: #FFF1B8;
    color: #8A5A00;
    font-size: 10px;
    font-weight: 800;
}

.driver-trip-status.completado {
    background: #D9F5E3;
    color: #166534;
}

/* ============================================================
   MODALES
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: rgba(13, 43, 92, 0.58);
    display: none;
}

.modal-card {
    width: min(720px, 100%);
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 16px 45px rgba(13, 43, 92, 0.3);
    border: 1px solid #D0DAF0;
    padding: 0;
}

#venc-u-modal .modal-card,
#venc-c-modal .modal-card {
    padding: 10px;
}

/* ============================================================
   MODAL EDITAR CAMIÓN - Layout forzado por filas
   ============================================================ */
/* ============================================================
   MODAL EDITAR CAMIÓN - Layout 4 filas
   ============================================================ */
#maestro-modal.camion-edit .modal-card {
    width: min(1100px, 100%);
}

#maestro-modal.camion-edit .modal-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px 16px;
    padding: 18px;
}

#maestro-modal.camion-edit .modal-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

/* ============================================================
   FILA 1: Patente(2) Tipo(2) Marca(3) Modelo(3) Año(2) = 12
   ============================================================ */
#maestro-modal.camion-edit .camion-cabecera-id {
    grid-row: 1;
    grid-column: 1 / span 2;
}
#maestro-modal.camion-edit .camion-tipo {
    grid-row: 1;
    grid-column: 3 / span 2;
}
#maestro-modal.camion-edit .camion-marca {
    grid-row: 1;
    grid-column: 5 / span 3;
}
#maestro-modal.camion-edit .camion-modelo {
    grid-row: 1;
    grid-column: 8 / span 3;
}
#maestro-modal.camion-edit .camion-anio {
    grid-row: 1;
    grid-column: 11 / span 2;
}

/* ============================================================
   FILA 2: Fecha(2) Característica(3) N° Serie(3) Propiedad(4) = 12
   ============================================================ */
#maestro-modal.camion-edit .camion-fecha {
    grid-row: 2;
    grid-column: 1 / span 2;
}
#maestro-modal.camion-edit .camion-caracteristica {
    grid-row: 2;
    grid-column: 3 / span 3;
}
#maestro-modal.camion-edit .camion-nro-serie {
    grid-row: 2;
    grid-column: 6 / span 3;
}
#maestro-modal.camion-edit .camion-propiedad {
    grid-row: 2;
    grid-column: 9 / span 4;
}

/* ============================================================
   FILA 3: Estado(2) KM(2) Ejes(1) Gomas(1) Tanque(2) L100(2) Semi(2) = 12
   ============================================================ */
#maestro-modal.camion-edit .camion-estado {
    grid-row: 3;
    grid-column: 1 / span 2;
}
#maestro-modal.camion-edit .camion-km {
    grid-row: 3;
    grid-column: 3 / span 2;
}
#maestro-modal.camion-edit .camion-ejes {
    grid-row: 3;
    grid-column: 5 / span 1;
}
#maestro-modal.camion-edit .camion-gomas {
    grid-row: 3;
    grid-column: 6 / span 1;
}
#maestro-modal.camion-edit .camion-tanque {
    grid-row: 3;
    grid-column: 7 / span 2;
}
#maestro-modal.camion-edit .camion-l100 {
    grid-row: 3;
    grid-column: 9 / span 2;
}
#maestro-modal.camion-edit .camion-semi {
    grid-row: 3;
    grid-column: 11 / span 2;
}

/* ============================================================
   FILA 4: Chofer(5) + Observaciones(7)
   ============================================================ */
#maestro-modal.camion-edit .camion-chofer {
    grid-row: 4;
    grid-column: 1 / span 5;
}
#maestro-modal.camion-edit .camion-obs {
    grid-row: 4;
    grid-column: 6 / span 7;
}

/* ============================================================
   Inputs: los numéricos y fechas no se estiran
   ============================================================ */
#maestro-modal.camion-edit .camion-anio input,
#maestro-modal.camion-edit .camion-fecha input,
#maestro-modal.camion-edit .camion-km input,
#maestro-modal.camion-edit .camion-ejes input,
#maestro-modal.camion-edit .camion-gomas input,
#maestro-modal.camion-edit .camion-tanque input,
#maestro-modal.camion-edit .camion-l100 input {
    max-width: 100%;
}

/* ============================================================
   Labels
   ============================================================ */
#maestro-modal.camion-edit .modal-field label {
    font-size: 11px;
    font-weight: 700;
    color: #6B7A99;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: var(--navy);
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.modal-drag-handle {
    cursor: move;
    user-select: none;
}

.modal-header h3 {
    color: var(--amber);
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 18px;
    margin: 0;
}

.modal-header p {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 11px;
}

.modal-close {
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-radius: 6px;
    padding: 5px 9px;
    cursor: pointer;
    font-size: 18px;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 18px;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-field-wide {
    grid-column: 1 / -1;
}

.modal-field label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.modal-field input,
.modal-field select {
    padding: 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: 13px;
    font-family: 'Barlow', sans-serif;
    width: 100%;
    box-sizing: border-box;
}

.modal-field input[readonly] {
    background: #EEF3FB;
    color: var(--navy);
    font-weight: 700;
}

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

.gasoil-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.gasoil-kpis > div {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
    color: #fff;
    border-radius: 10px;
    padding: 12px;
}
.gasoil-kpis span, .gasoil-rendicion-kpis span {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    opacity: .7;
}
.gasoil-kpis strong {
    display: block;
    margin-top: 4px;
    font-size: 20px;
}
.gasoil-kpis .pending, .gasoil-chofer-block .pending { color: #fbbf24; }
.gasoil-kpis .completed, .gasoil-chofer-block .completed { color: #34d399; }
.gasoil-filtros {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.gasoil-filtros-linea {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}
.gasoil-filtros-selectores select {
    flex: 1 1 0;
}
.gasoil-registrar-carga {
    margin-left: auto;
    white-space: nowrap;
    background: #1B7340 !important;
    color: #fff !important;
    border-color: #1B7340 !important;
}
.gasoil-registrar-carga:hover {
    background: #145c32 !important;
    border-color: #145c32 !important;
}
.gasoil-filtros label {
    color: #64748b;
    font-size: 13px;
}
.gasoil-filtros input, .gasoil-filtros select, .gasoil-filtros button {
    height: 40px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
}
.gasoil-filtros input { margin-left: 4px; width: 150px; }
.gasoil-filtros select { min-width: 170px; }
.gasoil-rendicion-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.gasoil-rendicion-kpis > div {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
}
.gasoil-rendicion-kpis strong { color: #0f172a; font-size: 16px; }
.gasoil-chofer-block {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}
.gasoil-chofer-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border: 0;
    background: #fff;
    text-align: left;
    cursor: pointer;
}
.gasoil-chofer-head b { color: #1e293b; }
.gasoil-chofer-head em, .gasoil-ticket-row em {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-style: normal;
}
.gasoil-chofer-head em.completed, .gasoil-ticket-row em.completed { background: #d1fae5; color: #065f46; }
.gasoil-chofer-totals { color: #64748b; font-size: 12px; text-align: right; }
.gasoil-chofer-body { display: none; border-top: 1px solid #f1f5f9; padding: 0 16px 14px; }
.gasoil-chofer-body.open { display: block; }
.gasoil-ticket-table { overflow-x: auto; margin-bottom: 10px; }
.gasoil-ticket-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr .8fr 1.2fr 1fr 1fr;
    gap: 8px;
    align-items: center;
    min-width: 720px;
    padding: 9px 0;
    border-top: 1px solid #f1f5f9;
    font-size: 12px;
}
.gasoil-ticket-row.head { border-top: 0; color: #64748b; font-size: 10px; text-transform: uppercase; }

@media (max-width: 900px) {
    .gasoil-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .gasoil-rendicion-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .gasoil-kpis, .gasoil-rendicion-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gasoil-filtros-linea > * { width: 100%; }
    .gasoil-filtros-linea label { display: flex; align-items: center; }
    .gasoil-filtros input, .gasoil-filtros select { width: 100%; }
    .gasoil-chofer-head { align-items: flex-start; flex-direction: column; }
    .gasoil-chofer-totals { text-align: left; }
}

.gasoil-carga-grid .modal-field input,
.gasoil-carga-grid .modal-field select {
    height: 40px;
    padding: 0 12px;
}

.gasoil-carga-grid .modal-field input[type="number"] {
    text-align: right;
}

.gasoil-carga-assigned,
.gasoil-carga-total {
    min-height: 40px;
    height: 40px;
    box-sizing: border-box;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
}

.gasoil-carga-assigned {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
}

.gasoil-carga-assigned span:first-child {
    color: #334155;
    font-size: 13px;
    font-weight: 700;
}

.gasoil-carga-assigned span:last-child {
    color: #64748B;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gasoil-carga-total {
    justify-content: flex-end;
    background: #FEF3C7;
    border: 1px solid #FCD34D;
    color: #64748B;
    font-size: 13px;
}

.gasoil-carga-total span:last-child {
    color: #1E293B;
    font-size: 18px;
    font-weight: 700;
}

.gasoil-estado-pendiente {
    background-color: #FEE2E2 !important;
    border-color: #FCA5A5 !important;
    color: #991B1B !important;
    font-weight: 700;
}

.gasoil-estado-rendido {
    background-color: #DCFCE7 !important;
    border-color: #86EFAC !important;
    color: #166534 !important;
    font-weight: 700;
}

@media (max-width: 767px) {
    .gasoil-carga-grid {
        grid-template-columns: 1fr;
    }
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid #E0E6F0;
    background: #F8FAFD;
    border-radius: 0 0 12px 12px;
}

.modal-actions-right {
    display: flex;
    gap: 8px;
}

.modal-actions button {
    border: none;
    border-radius: 7px;
    padding: 9px 13px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.modal-delete {
    background: #FDECEA;
    border: 1px solid #E7A49C !important;
    color: var(--red);
}

.modal-cancel {
    background: #E0E6F0;
    color: var(--navy);
}

.modal-save {
    background: var(--green);
    color: #fff;
}

/* ============================================================
   GASOIL
   ============================================================ */
.gasoil-carga-item {
    display: grid;
    grid-template-columns: 110px 1fr 90px 120px auto;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #fff;
    border: 1px solid #E0E6F0;
    border-left: 4px solid var(--orange);
    border-radius: 7px;
    color: var(--navy);
    font-size: 12px;
}

.gasoil-carga-item small {
    grid-column: 2 / 5;
    color: var(--muted);
}

.gasoil-carga-item > span:nth-child(3),
.gasoil-carga-item > span:nth-child(4) {
    text-align: right;
    white-space: nowrap;
}

.gasoil-carga-item .m-edit {
    grid-column: 5;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
}

.gasoil-transferencia-item {
    display: grid;
    grid-template-columns: 110px 1fr 130px;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #fff;
    border: 1px solid #E0E6F0;
    border-left: 4px solid var(--teal);
    border-radius: 7px;
    color: var(--navy);
    font-size: 12px;
}

.gasoil-transferencia-item small {
    grid-column: 1 / -1;
    color: var(--muted);
}

.gasoil-transferencia-table {
    margin-top: 12px;
    overflow-x: auto;
}

.gasoil-transferencia-head,
.gasoil-transferencia-row {
    min-width: 760px;
    display: grid;
    grid-template-columns: 170px 1.5fr 130px 120px 130px 90px 95px;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    font-size: 12px;
}

.gasoil-transferencia-head {
    background: var(--navy);
    color: var(--amber);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.gasoil-transferencia-row {
    border-bottom: 1px solid #E0E6F0;
    color: var(--navy);
}

.gasoil-transferencia-row:nth-child(odd) {
    background: #F8FAFD;
}

.transfer-status {
    display: inline-block;
    width: max-content;
    padding: 3px 9px;
    border-radius: 12px;
    background: #FFF3D0;
    color: #B8600A;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
}

.transfer-status.rendido {
    background: #D9F5E3;
    color: var(--green);
}

.gasoil-rendicion-table {
    margin-top: 12px;
    overflow-x: auto;
}

.gasoil-rendicion-head,
.gasoil-rendicion-row {
    min-width: 980px;
    display: grid;
    grid-template-columns: 105px 105px 55px 65px 65px 95px 1fr 75px 90px;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    font-size: 11px;
}

.gasoil-rendicion-head {
    background: var(--navy);
    color: var(--amber);
    font-weight: 800;
    text-transform: uppercase;
}

.gasoil-rendicion-row {
    color: var(--navy);
    border-bottom: 1px solid #E0E6F0;
}

.gasoil-rendicion-row:nth-child(odd) {
    background: #F8FAFD;
}

.gas-slot {
    background: var(--ofill);
    border: 1.5px solid #FFCC80;
    border-radius: 9px;
    padding: 13px 14px;
}

.gas-slot h4 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: var(--orange);
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.gas-total {
    background: var(--navy);
    border-radius: 9px;
    padding: 11px 16px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 11px;
}

.gt-item .gt-lbl {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.82);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gt-item .gt-val {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--amber);
    margin-top: 2px;
}

/* ============================================================
   VIAJE CRUDO
   ============================================================ */
.crudo-header {
    background: #0D2B5C;
    color: #fff;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
}

.crudo-header h3 {
    margin: 0 0 14px;
    font-size: 17px;
    color: #FFB300;
}

.crudo-hgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.crudo-hgrid input,
.crudo-hgrid select {
    padding: 8px 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 7px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 100%;
    box-sizing: border-box;
}

.crudo-hgrid input::placeholder {
    color: rgba(255, 255, 255, 0.70);
}

.crudo-hgrid select {
    background: #1a3a6b;
}

.crudo-hgrid option {
    background: #0D2B5C;
}

.crudo-id-badge {
    background: #FFB300;
    color: #0D2B5C;
    font-weight: 900;
    font-size: 18px;
    padding: 6px 14px;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 12px;
}

/* --- TRAMO CARD --- */
.tramo-card {
    border: 2px solid #E0E6F0;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 10px;
    background: #fff;
    position: relative;
}

.tramo-card.cargado {
    border-left: 5px solid #1B7340;
}

.tramo-card.vacio {
    border-left: 5px solid #6B7BA4;
}

.tramo-card.nn {
    border-left: 5px solid #C0392B;
}

.tramo-label {
    font-weight: 700;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 5px;
    display: inline-block;
    margin-bottom: 10px;
}

.lbl-cargado {
    background: #E8F5E9;
    color: #1B7340;
}

.lbl-vacio {
    background: #ECEFF1;
    color: #6B7BA4;
}

.lbl-nn {
    background: #FFEBEE;
    color: #C0392B;
}

.tramo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.tramo-grid input,
.tramo-grid select {
    padding: 7px 9px;
    border: 1.5px solid #CBD5E0;
    border-radius: 6px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
}

.tramo-del2 {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ffebee;
    color: #C0392B;
    border: 1px solid #ffcdd2;
    padding: 3px 9px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.add-tramo-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.btn-carg {
    background: #1B7340;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.btn-vac {
    background: #546E7A;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.btn-nn2 {
    background: #C0392B;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.btn-save-crudo {
    background: #FFB300;
    color: #0D2B5C;
    border: none;
    padding: 12px 32px;
    border-radius: 10px;
    font-weight: 900;
    font-size: 15px;
    cursor: pointer;
    margin-top: 8px;
}

.crudo-counter {
    font-size: 12px;
    color: #6B7BA4;
}

/* ============================================================
   COMPLETAR
   ============================================================ */
.semaforo-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.s-card {
    flex: 1;
    min-width: 160px;
    border-radius: 10px;
    padding: 14px 18px;
    text-align: center;
}

.s-red {
    background: #FFEBEE;
    border: 2px solid #C0392B;
}

.s-yellow {
    background: #FFFDE7;
    border: 2px solid #FFB300;
}

.s-green {
    background: #E8F5E9;
    border: 2px solid #1B7340;
}

.s-num {
    font-size: 32px;
    font-weight: 900;
}

.s-red .s-num {
    color: #C0392B;
}

.s-yellow .s-num {
    color: #E65100;
}

.s-green .s-num {
    color: #1B7340;
}

.s-label {
    font-size: 12px;
    color: #555;
    margin-top: 4px;
}

.pendiente-card {
    border: 2px solid #E0E6F0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.pendiente-card:hover {
    border-color: #FFB300;
    box-shadow: 0 2px 12px rgba(255, 179, 0, 0.2);
}

.pendiente-card.alerta-red {
    border-left: 5px solid #C0392B;
}

.pendiente-card.alerta-yellow {
    border-left: 5px solid #FFB300;
}

.pendiente-card.alerta-green {
    border-left: 5px solid #1B7340;
}

.pend-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.pend-id {
    font-weight: 900;
    color: #0D2B5C;
    font-size: 15px;
}

.pend-dias {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.pend-dias.red {
    background: #FFEBEE;
    color: #C0392B;
}

.pend-dias.yellow {
    background: #FFFDE7;
    color: #E65100;
}

.pend-dias.green {
    background: #E8F5E9;
    color: #1B7340;
}

.pend-detail {
    font-size: 12px;
    color: #6B7BA4;
}

.comp-pendiente-card {
    padding: 14px 16px;
    cursor: pointer;
}

.comp-pendiente-top {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}

.comp-pendiente-top .pend-dias {
    justify-self: center;
}

.comp-progreso {
    justify-self: end;
    color: var(--blue);
    font-size: 11px;
    white-space: nowrap;
}

.comp-cliente {
    color: var(--orange);
    font-size: 12px;
    font-weight: 700;
    margin-top: 3px;
}

.comp-cliente span {
    margin-left: 3px;
}

.comp-panel {
    background: #fff;
    border: 2px solid #0D2B5C;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.comp-panel h3 {
    color: #0D2B5C;
    margin: 0 0 16px;
    font-size: 16px;
}

.comp-tramo {
    border: 2px solid #D9E2F1;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    background: #fff;
}

.comp-tramo-no-facturable {
    background: #F7F9FC;
}

.comp-tramo-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    color: var(--navy);
    font-size: 13px;
}

.comp-tramo-km {
    color: var(--muted);
    font-size: 11px;
    margin-left: 8px;
}

.comp-status {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
    margin-left: 8px;
}

.comp-status.pendiente {
    color: #8A5A00;
    background: #FFF1B8;
}

.comp-status.facturado {
    color: #166534;
    background: #D9F5E3;
}

.comp-status.crudo {
    color: #C0392B;
}

.comp-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1.1fr;
    gap: 9px;
}

.comp-pago-label {
    color: var(--navy);
    font-size: 12px;
    font-weight: 700;
    margin: 10px 0 5px;
}

.comp-pago {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
}

.comp-pago button {
    border: 2px solid #C8D4E6;
    border-radius: 7px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
    font-weight: 700;
    padding: 7px 10px;
}

.comp-pago button.on {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.comp-total-row {
    display: flex;
    justify-content: flex-end;
    gap: 18px;
    color: var(--muted);
    font-size: 12px;
    margin: 9px 0;
}

.comp-total-row strong {
    color: var(--navy);
}

.comp-close-tramo {
    width: 100%;
    border: none;
    border-radius: 7px;
    padding: 9px 12px;
    background: var(--green);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
}

.comp-close-tramo:hover {
    background: var(--green2);
}

.comp-nonbillable {
    color: var(--muted);
    font-size: 12px;
    font-style: italic;
}

.comp-km-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #55C88A;
    vertical-align: -1px;
}

.cpk-box {
    background: #0D2B5C;
    color: #fff;
    border-radius: 10px;
    padding: 14px;
    display: grid;
    grid-template-columns:
        minmax(70px, 0.6fr)    /* Total tramos */
        minmax(120px, 1fr)     /* Km Composición */
        minmax(90px, 0.7fr)    /* % km vacío */
        minmax(110px, 0.9fr)   /* KM tramos */
        minmax(130px, 1fr)     /* CPK Aparente */
        minmax(130px, 1fr)     /* CPK Real */
        minmax(150px, 1.2fr);  /* Precio mínimo sugerido */
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.cpk-item {
    text-align: center;
    min-width: 0;
}

.cpk-km-summary {
    text-align: left;
}

.cpk-km-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1.2;
}

.cpk-km-row strong {
    min-width: 68px;
    color: #FFB300;
    text-align: right;
    font-size: 14px;
}

.cpk-km-row span {
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
}

.cpk-val {
    font-size: 22px;
    font-weight: 900;
    color: #FFB300;
}

.cpk-lbl {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.90);
    margin-top: 3px;
}

.no-crudos {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 15px;
}

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.tog-row {
    display: flex;
    align-items: center;
    gap: 7px;
}

.tog-lbl {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--muted);
}

.sw {
    position: relative;
    width: 30px;
    height: 16px;
    flex-shrink: 0;
}

.sw input {
    opacity: 0;
    width: 0;
    height: 0;
}

.sl {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 16px;
    cursor: pointer;
    transition: 0.18s;
}

.sl::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transition: 0.18s;
}

.sw input:checked+.sl {
    background: var(--green);
}

.sw input:checked+.sl::before {
    transform: translateX(14px);
}

/* ============================================================
   TRAMOS WRAP
   ============================================================ */
.tramo-wrap {
    position: relative;
    border: 2px solid var(--border);
    border-radius: 11px;
    padding: 16px 14px 12px;
    margin-bottom: 12px;
    background: #FAFCFF;
    transition: border-color 0.2s;
}

.tramo-wrap[data-tipo="VACIO"] {
    background: var(--vfill);
    border-color: var(--vb);
}

.tramo-wrap[data-tipo="NN"] {
    background: var(--nnfill);
    border-color: var(--nn);
}

.tramo-pill {
    position: absolute;
    top: -12px;
    left: 12px;
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 800;
    font-size: 11px;
    padding: 2px 11px;
    border-radius: 14px;
    color: #fff;
    background: var(--navy);
    white-space: nowrap;
}

.tramo-wrap[data-tipo="VACIO"] .tramo-pill {
    background: var(--vb);
}

.tramo-wrap[data-tipo="NN"] .tramo-pill {
    background: var(--nn);
}

.tramo-del {
    position: absolute;
    top: 9px;
    right: 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 9px;
    padding: 3px 7px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Barlow', sans-serif;
    transition: all 0.13s;
}

.tramo-del:hover {
    background: var(--rfill);
    border-color: var(--red);
    color: var(--red);
}

/* ============================================================
   TIPO BAR
   ============================================================ */
.tipo-bar {
    display: flex;
    gap: 5px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tb {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.6px;
    padding: 4px 12px;
    border-radius: 14px;
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: all 0.13s;
    background: transparent;
    color: var(--muted);
}

.tb.tc.on {
    background: var(--navy);
    color: var(--amber);
    border-color: var(--navy);
}

.tb.tv.on {
    background: var(--vb);
    color: #fff;
    border-color: var(--vb);
}

.tb.tn.on {
    background: var(--nn);
    color: #fff;
    border-color: var(--nn);
}

/* ============================================================
   NUEVO PANEL
   ============================================================ */
.nuevo-panel {
    background: var(--gdfill);
    border: 2px solid #FFD54F;
    border-radius: 9px;
    padding: 12px 14px;
    margin-top: 10px;
}

.nuevo-panel h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 10px;
}

.nt-warn {
    font-size: 10.5px;
    color: var(--gold);
    background: #FFF9C4;
    border: 1px dashed #E6B800;
    border-radius: 6px;
    padding: 7px 10px;
    margin-top: 8px;
}

.nn-warn {
    font-size: 11px;
    color: var(--nn);
    background: var(--nnfill);
    border: 1.5px dashed var(--nn);
    border-radius: 7px;
    padding: 9px 12px;
    margin-top: 8px;
}

/* ============================================================
   KM BACKGROUND
   ============================================================ */
.km-bg {
    background: linear-gradient(135deg, var(--teal) 0%, #003F47 100%);
    border-radius: 10px;
    padding: 13px 16px;
    margin-bottom: 10px;
}

.km-bg h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    margin-bottom: 10px;
}

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

.kmb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    padding: 9px 11px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.kmb .kl {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
}

.kmb .kv {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin-top: 2px;
}

.kmb.hi .kv {
    color: var(--amber);
    font-size: 21px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .hdr {
        height: 48px;
        padding: 0 8px;
    }

    .logo img {
        height: 26px;
    }

    .logo-n {
        font-size: 14px;
    }

    .version-badge {
        display: none;
    }

    .hdr-btn {
        width: 28px;
        height: 28px;
    }

    .tab {
        padding: 5px 12px 6px;
        font-size: 10px;
    }

    .tab .tab-label {
        font-size: 10px;
    }

    .tab .tab-icon {
        font-size: 12px;
    }

    .nav-scroll {
        padding: 0 8px;
    }

    .dropdown-menu {
        min-width: 170px;
    }

    .dropdown-item {
        font-size: 12px;
        padding: 8px 14px;
    }

    .g4,
    .g5,
    .res-grid,
    .km-grid {
        grid-template-columns: 1fr 1fr;
    }

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

    .s3,
    .s4,
    .s5 {
        grid-column: span 2;
    }

    .gas-total {
        grid-template-columns: 1fr 1fr;
    }

    .comp-tramo-top {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .comp-fields {
        grid-template-columns: 1fr;
    }

    .comp-total-row {
        justify-content: space-between;
    }

    .comp-pendiente-top {
        grid-template-columns: 1fr auto;
    }

    .comp-pendiente-top .pend-dias {
        justify-self: end;
    }

    .comp-progreso {
        grid-column: 1 / -1;
        justify-self: start;
    }

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

    .modal-field-wide {
        grid-column: auto;
    }

    .modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .modal-actions-right {
        justify-content: flex-end;
    }

        #maestro-modal.camion-edit .modal-grid {
        grid-template-columns: 1fr 1fr; /* 2 columnas en tablet */
    }
    /* Resetear los grid-column para que fluyan naturalmente */
    #maestro-modal.camion-edit .camion-cabecera-id,
    #maestro-modal.camion-edit .camion-tipo,
    #maestro-modal.camion-edit .camion-marca,
    #maestro-modal.camion-edit .camion-modelo,
    #maestro-modal.camion-edit .camion-anio,
    #maestro-modal.camion-edit .camion-fecha,
    #maestro-modal.camion-edit .camion-caracteristica,
    #maestro-modal.camion-edit .camion-nro-serie,
    #maestro-modal.camion-edit .camion-propiedad,
    #maestro-modal.camion-edit .camion-estado,
    #maestro-modal.camion-edit .camion-km,
    #maestro-modal.camion-edit .camion-ejes,
    #maestro-modal.camion-edit .camion-gomas,
    #maestro-modal.camion-edit .camion-tanque,
    #maestro-modal.camion-edit .camion-l100,
    #maestro-modal.camion-edit .camion-semi,
    #maestro-modal.camion-edit .camion-chofer,
    #maestro-modal.camion-edit .camion-obs {
        grid-row: auto;
        grid-column: auto;
    }
}

@media (max-width: 600px) {
    .hdr {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        padding: 8px;
    }

    .logo {
        clip-path: none;
        padding: 8px 12px;
        border-radius: 8px;
        justify-content: center;
        background: var(--amber);
    }

    .logo-n {
        color: var(--navy);
        background: transparent;
        backdrop-filter: none;
        border: none;
        padding: 0;
    }

    .logo img {
        filter: none;
    }

    .hdr-actions {
        padding-right: 0;
        justify-content: flex-end;
    }

    .g4,
    .g5,
    .g3 {
        grid-template-columns: 1fr;
    }

    .s3,
    .s4,
    .s5 {
        grid-column: span 1;
    }

    .card-body {
        padding: 12px;
    }

    .infobox {
        flex-direction: column;
        gap: 6px;
    }

    .tab {
        font-size: 9px;
        padding: 4px 8px 5px;
    }

    .tab .tab-label {
        font-size: 8px;
    }

    .tab .tab-icon {
        font-size: 10px;
    }

    main {
        padding: 12px 6px 60px;
    }

    .dropdown-menu {
        min-width: 150px;
        left: -10px;
    }

    .dropdown-item {
        font-size: 11px;
        padding: 7px 12px;
    }

    .dropdown-arrow {
        font-size: 8px;
        right: 6px;
    }

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

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

    .semaforo-bar {
        flex-direction: column;
    }

    .s-card {
        min-width: auto;
    }

    .cpk-box {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .cpk-km-summary {
        grid-column: 1 / -1;
    }

    .gasoil-carga-item {
        grid-template-columns: 1fr 1fr;
    }

    .gasoil-carga-item small {
        grid-column: 1 / -1;
    }

    .gasoil-carga-item .m-edit {
        grid-column: 2;
        grid-row: auto;
    }

    .gasoil-transferencia-item {
        grid-template-columns: 1fr 1fr;
    }

    .gasoil-transferencia-head,
    .gasoil-transferencia-row,
    .gasoil-rendicion-head,
    .gasoil-rendicion-row {
        grid-template-columns: 1fr;
        min-width: auto;
        gap: 4px;
        padding: 12px;
    }

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

    .modal-field-wide {
        grid-column: span 1;
    }

    .modal-actions {
        flex-direction: column;
        gap: 10px;
    }

    .modal-actions-right {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    header {
        padding: 0 0.6rem;
    }

    .hdr {
        padding: 4px;
    }

    .logo img {
        height: 22px;
    }

    .logo-n {
        font-size: 11px;
        padding: 0.1rem 0.6rem;
    }

    .hdr-btn {
        width: 24px;
        height: 24px;
    }

    .hdr-btn svg {
        width: 14px;
        height: 14px;
    }

    .tab {
        padding: 0.25rem 0.7rem;
        gap: 0.3rem;
        font-size: 0.7rem;
    }

    .tab .tab-icon {
        font-size: 0.9rem;
    }

    .tab .tab-label {
        font-size: 0.65rem;
    }

    .dropdown-menu {
        min-width: 170px;
        left: -10px;
    }

    .crudo-hgrid {
        grid-template-columns: 1fr;
    }

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

    .add-tramo-row {
        flex-direction: column;
    }

    .add-tramo-row button {
        width: 100%;
    }

    .comp-pago {
        grid-template-columns: 1fr;
    }

    .btn-row {
        flex-direction: column;
    }

    .btn-row .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   ASISTENTE - Chat estilo WhatsApp
   ============================================================ */
#ai-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
}

.account-widget {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(360px, calc(100vw - 120px));
    padding: 10px 14px;
    border: 1px solid #d7dfeb;
    border-radius: 12px;
    background: #fff;
    color: #6b7ba4;
    font-size: 11px;
    box-shadow: 0 4px 12px rgba(13, 43, 92, 0.14);
}

.account-widget-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-widget a {
    flex-shrink: 0;
    color: #0d2b5c;
    font-weight: 700;
    text-decoration: none;
}

#open-chat-btn {
    padding: 10px 16px;
    border: 0;
    border-radius: 50px;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(13, 43, 92, 0.22);
}

#chat-box {
    display: none;
    flex-direction: column;
    position: absolute;
    right: 0;
    bottom: 50px;
    width: min(360px, calc(100vw - 24px));
    height: min(500px, calc(100vh - 100px));
    overflow: hidden;
    background: #efeae2;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(13, 43, 92, 0.2);
}

.chat-header {
    padding: 13px 16px;
    background: var(--teal);
    color: #fff;
    font-weight: 700;
}

#chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    padding: 14px 10px;
    overflow-y: auto;
    background-color: #efeae2;
    background-image: radial-gradient(rgba(0, 110, 122, 0.08) 1px, transparent 1px);
    background-size: 16px 16px;
    font-size: 14px;
}

.chat-message {
    display: flex;
    width: 100%;
}

.chat-message-user {
    justify-content: flex-end;
}

.chat-message-assistant {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 82%;
    padding: 8px 10px;
    border-radius: 10px;
    color: #1f2937;
    line-height: 1.4;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.08);
}

.chat-message-user .chat-bubble {
    background: #d9fdd3;
    border-top-right-radius: 3px;
}

.chat-message-assistant .chat-bubble {
    background: #fff;
    border-top-left-radius: 3px;
}

.chat-sender {
    display: block;
    margin-bottom: 3px;
    color: var(--teal);
    font-size: 11px;
    font-weight: 800;
}

.chat-message-user .chat-sender {
    color: var(--green);
    text-align: right;
}

.chat-composer {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid #d6d3ce;
    background: #f7f7f7;
}

#chat-input {
    min-width: 0;
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 18px;
    font: inherit;
}

#send-btn {
    padding: 8px 12px;
    border: 0;
    border-radius: 18px;
    background: var(--teal);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

@media (max-width: 480px) {
    #ai-chat-widget {
        right: 12px;
        bottom: 12px;
    }

    .account-widget {
        left: 12px;
        bottom: 12px;
        max-width: calc(100vw - 120px);
        padding: 9px 10px;
    }

    #chat-box {
        right: -4px;
        bottom: 48px;
        height: min(560px, calc(100vh - 80px));
    }
}

.history-list-card {
    margin-top: 18px;
}

#out-mant-panel, #out-goma, #out-stock {
    display: none !important;
}

.registro-form-modal {
    position: relative;
    width: min(980px, 100%);
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    padding: 18px;
    border-radius: 12px;
    background: var(--bg);
    box-shadow: 0 16px 45px rgba(13, 43, 92, 0.3);
}

.registro-modal-close {
    display: block;
    margin: 0 0 10px auto;
    border: 0;
    border-radius: 7px;
    padding: 7px 12px;
    background: #e0e6f0;
    color: #0d2b5c;
    cursor: pointer;
    font-weight: 700;
}

.registro-form-modal .infobox,
.registro-form-modal .card {
    margin-top: 0;
}

.registro-new-btn {
    margin-left: auto;
    padding: 7px 12px;
    font-size: 12px;
}

.mant-filtros {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 14px 0;
}

.mant-filtros label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #555;
    font-size: 11px;
    font-weight: 700;
}

.mant-filtros select,
.mant-filtros input {
    min-width: 150px;
    padding: 7px 9px;
    border: 1.5px solid #C8D0E0;
    border-radius: 7px;
    background: #fff;
    font: inherit;
}

.mant-filtros .btn {
    padding: 7px 12px;
    font-size: 11px;
}

.registro-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid #d9e2f1;
    border-radius: 10px;
    background: #fff;
}

.registro-detail {
    margin-top: 4px;
    color: #5f6d85;
    font-size: 12px;
}

.registro-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.registro-actions button {
    border: 0;
    border-radius: 7px;
    padding: 7px 10px;
    color: #fff;
    background: #0d2b5c;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.registro-actions button:first-child { background: #6b7ba4; }
.registro-actions button.danger { background: #c0392b; }

.completion-modal-card {
    width: min(980px, 100%);
    margin: 0;
}

#completar-panel {
    height: calc(100vh - 36px);
    max-height: calc(100vh - 36px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

#completar-modal {
    overflow: hidden;
    overscroll-behavior: contain;
}

#completar-panel > .comp-modal-heading,
#completar-panel > #comp-action-bar,
#completar-panel > #comp-nuevo-tramo,
#completar-panel > #comp-cpk-box,
#completar-panel > #comp-out {
    flex: 0 0 auto;
}

#completar-panel > #comp-tramos-cards {
    flex: 1 1 0;
    height: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px 6px 4px 2px;
}

.pv-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.pv-toolbar button.on {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
}

#pv-f-desde,
#pv-f-hasta {
    width: 150px;
    min-width: 150px;
    box-sizing: border-box;
}

#pv-f-todos,
#pv-f-crudo,
#pv-f-comp,
#pv-f-mes-actual,
#pv-f-mes-pasado,
#pv-f-desde,
#pv-f-hasta {
    height: 40px;
    min-height: 40px;
    box-sizing: border-box;
}

.pv-filters-main > button {
    flex: 1 1 0;
    min-width: max-content;
    justify-content: center;
}

.pv-filters-main > button.on,
.gasoil-filtros button.on {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
}

#pv-f-todos {
    flex: 0.6 1 0;
}

#pv-f-crudo,
#pv-f-comp {
    flex: 1.2 1 0;
}

.pv-toolbar select {
    flex: 1 1 200px;
    width: auto;
    min-width: 200px;
    max-width: 260px;
}

.pv-new-trip {
    margin-left: auto;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    min-height: 40px;
    background: #2e8b4f;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    width: auto;
}

.pv-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 16px 0 4px;
}

.pv-page-nav,
.pv-page-number {
    min-width: 36px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #C8D0E0;
    border-radius: 7px;
    background: #fff;
    color: #0D2B5C;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.pv-page-number.on {
    background: #0D2B5C;
    border-color: #0D2B5C;
    color: #fff;
}

.pv-page-nav:disabled {
    opacity: .45;
    cursor: not-allowed;
}

@media (max-width: 639px) {
    .pv-toolbar select {
        width: 100%;
        max-width: none;
    }
}

.comp-modal-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.comp-cabecera {
    flex: 1 1 auto;
    min-width: 0;
    background: #F4F6FB;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.comp-cabecera-left {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
}

.comp-cabecera-right {
    flex: 0 0 auto;
    text-align: right;
    white-space: nowrap;
}

.comp-cabecera-right .comp-status{
    flex: 0 0 auto;
    text-align: right;
    white-space: nowrap;
    font-size: 12px;
}

.edit-viaje-header {
    margin-bottom: 0;
}

.edit-viaje-obs {
    margin-top: 10px;
}

.edit-viaje-obs label {
    display: block;
    color: #555;
    font-size: 12px;
    font-weight: 700;
}

.edit-viaje-obs input {
    width: 100%;
    margin-top: 4px;
    padding: 10px 12px;
    border: 1.5px solid #C8D0E0;
    border-radius: 8px;
    font: inherit;
    box-sizing: border-box;
}

.comp-list-edit {
    border: 0;
    border-radius: 6px;
    padding: 5px 10px;
    background: #6B7BA4;
    color: #fff;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.comp-list-actions {
    display: flex;
    gap: 6px;
    margin-top: 7px;
    flex-wrap: wrap;
}

.comp-list-complete,
.comp-list-view {
    border: 0;
    border-radius: 6px;
    padding: 5px 10px;
    color: #fff;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.comp-list-complete { background: #1B7340; }
.comp-list-view { background: #0D2B5C; }

@media (max-width: 700px) {
    .comp-modal-heading {
        align-items: stretch;
    }

    .comp-modal-heading h3,
    .comp-modal-heading button,
    .comp-cabecera {
        width: 100%;
    }

}


/* --- Modal de tramos: nuevo layout --- */
.tramo-card {
    background: #fff;
    border: 1px solid #E0E6F0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.tramo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #E0E6F0;
    flex-wrap: wrap;
    gap: 8px;
}

.tramo-title {
    font-weight: 700;
    color: #0D2B5C;
    font-size: 14px;
}

.comp-tramo-type {
    padding: 4px 8px;
    border-radius: 6px;
    background: #EEF3FB;
    color: #0D2B5C;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.tramo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.tramo-grid .full-width {
    grid-column: 1 / -1;
}

.tramo-grid input,
.tramo-grid select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #D1D9E6;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
    background: #FAFBFC;
    box-sizing: border-box;
    transition: border 0.2s, background 0.2s;
}

.tramo-grid input:focus,
.tramo-grid select:focus {
    border-color: #1565C0;
    outline: none;
    background: #fff;
}

.pago-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.pago-label {
    font-size: 12px;
    font-weight: 700;
    color: #555;
}

.btn-pago {
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid #D1D9E6;
    background: #fff;
    color: #555;
    transition: all 0.2s;
}

.btn-pago.activo {
    background: #0D2B5C;
    color: #fff;
    border-color: #0D2B5C;
}

.btn-pago.cta-cte.activo {
    background: #F9A825;
    color: #fff;
    border-color: #F9A825;
}

.tramo-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #F0F3F8;
    flex-wrap: wrap;
    gap: 10px;
}

.tramo-totales {
    font-size: 13px;
    color: #555;
}

.tramo-totales span {
    font-weight: 700;
    color: #0D2B5C;
}

.btn-guardar-tramo {
    background: #1B7340;
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-guardar-tramo:hover {
    background: #145A32;
}

/* Responsive: 1 columna en pantallas chicas */
@media (max-width: 560px) {
    .tramo-grid {
        grid-template-columns: 1fr;
    }
    .tramo-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-guardar-tramo {
        justify-content: center;
    }
        #maestro-modal.camion-edit .modal-grid {
        grid-template-columns: 1fr; /* 1 columna en móvil */
    }
}

/* ============================================================
   COMPLETAR PANEL - Tramo Card (v3, layout horizontal)
   ============================================================ */

/* --- Tarjeta --- */
.cp-tramo-card {
    background: #fff;
    border: 1.5px solid #E0E6F0;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    border-block-color: #0D2B5C;
}

/* --- FILA 1: Cabecera (todo en una línea) --- */
.cp-tramo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 12px;
    border-bottom: 1px solid #F0F3F8;
    flex-wrap: wrap;
}

.cp-tramo-header-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-shrink: 0;
}

.cp-tramo-title {
    font-size: 14px;
    font-weight: 700;
    color: #0D2B5C;
}

.cp-tramo-km {
    font-size: 12px;
    color: #6B7A99;
    font-weight: 500;
}

.cp-tramo-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cp-tramo-type {
    font-size: 10px;
    font-weight: 800;
    background: #E3F2FD;
    color: #1565C0;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.cp-tramo-cliente {
    font-size: 12px;
    color: #6B7A99;
    white-space: nowrap;
}

.cp-tramo-cliente strong {
    color: #0D2B5C;
}

.cp-btn-eliminar {
    background: #FDECEC;
    color: #C0392B;
    border: 1px solid #F1B5B5;
    padding: 4px 8px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    line-height: 1;
}

.cp-btn-eliminar:hover {
    background: #F8D7D7;
}

/* --- FILA 2: Inputs + Pago (una sola línea) --- */
.cp-tramo-line {
    display: grid;
     grid-template-columns: 0.8fr 0.8fr 0.9fr 1.0fr 2.0fr; /* 5 columnas */
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}

.input-valores,
input[type="number"] {
    text-align: right;
}

.cp-field-spacer {
    /* Columna vacía que empuja el pago hacia la derecha */
    min-width: 0;
}
.cp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.cp-field label {
    font-size: 10px;
    font-weight: 800;
    color: #6B7A99;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.cp-field input,
.cp-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #D1D9E6;
    border-radius: 7px;
    font-size: 13px;
    color: #0D2B5C;
    background: #FAFBFC;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
}

.cp-field input:focus,
.cp-field select:focus {
    border-color: #1565C0;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(21,101,192,0.1);
}

/* Botones de pago en la misma fila */
.cp-pago-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.cp-btn-pago {
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 1.5px solid #D1D9E6;
    background: #fff;
    color: #555;
    transition: all 0.15s;
    white-space: nowrap;
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.cp-btn-pago.activo {
    background: #0D2B5C;
    color: #fff;
    border-color: #0D2B5C;
}

.cp-btn-pago.cta-cte.activo {
    background: #F9A825;
    color: #fff;
    border-color: #F9A825;
}

.cp-cta-propia-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.15;
}

.cp-cta-propia-label input {
    width: 16px;
    height: 16px;
    margin: 0;
}

/* --- FILA 3: Totales + Botón --- */
.cp-tramo-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid #F0F3F8;
    padding: 10px;
    background: #F4F6FB;
    border-radius: 7px;
}

.cp-tramo-totales {
    display: flex;
    align-items: baseline;
    gap: 18px;
}

.cp-iva-label {
    font-size: 12px;
    color: #6B7A99;
    font-weight: 700;
}

.cp-iva-label span {
    color: #0D2B5C;
    font-weight: 800;
}

.cp-total-label {
    font-size: 13px;
    color: #6B7A99;
    font-weight: 700;
}

.cp-total-label .total-val {
    color: #1B7340;
    font-size: 20px;
    font-weight: 900;
    margin-left: 4px;
}

.cp-btn-guardar {
    background: #1B7340;
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 7px;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.cp-btn-guardar:hover {
    background: #145C32;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .cp-tramo-line {
        grid-template-columns: 1fr 1fr;
    }
    .cp-field-pago {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .cp-tramo-line {
        grid-template-columns: 1fr;
    }
    .cp-tramo-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .cp-tramo-header-right {
        justify-content: flex-start;
    }
    .cp-tramo-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .cp-tramo-totales {
        justify-content: space-between;
    }
    .cp-btn-guardar {
        justify-content: center;
    }
}