﻿html{ scrollbar-gutter: stable both-edges; }
    @supports not (scrollbar-gutter: stable) { html{ overflow-y: scroll; } }

    :root{
      --c-bg:#f6f8fb; --c-surface:#fff;
      --c-primary:#1e88e5; --c-accent:#ff6f00;
      --c-ink:#0b1f3a; --c-muted:#5f7187;
      --c-border:#e8edf5;
      --shadow:0 6px 20px rgba(11,31,58,.08);
      --radius:14px; --container:min(1120px,92vw);
      --control-h:48px; --nav-offset:0px;
    }

    *{box-sizing:border-box}
    body{margin:0;font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,Ubuntu,Cantarell,"Helvetica Neue",Arial,"Noto Sans",sans-serif;color:var(--c-ink);background:linear-gradient(180deg,#f9fbff,var(--c-bg));line-height:1.5}
    a{color:inherit;text-decoration:none}
    img{max-width:100%;display:block}
    .container{width:var(--container);margin-inline:auto;padding-inline:8px}
    .btn{display:inline-flex;align-items:center;justify-content:center;padding:.9rem 1.15rem;border-radius:12px;font-weight:700;border:2px solid transparent;transition:.2s;cursor:pointer}
    button.btn, a.btn { font-size:1rem; font-weight:700; line-height:1; }
    .btn.primary{background:var(--c-primary);color:#fff}
    .btn.primary:hover{filter:brightness(.92)}
    .btn.outline{border-color:var(--c-primary);color:var(--c-primary);background:#fff}
    .btn.outline:hover{background:#eef5ff}

    .topbar{background:var(--c-ink);color:#cfe2ff;font-size:.9rem}
    .topbar .container{display:flex;gap:16px;align-items:center;justify-content:space-between;padding:.70rem 8px;min-height:60px}
    .topbar .tb-right{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
    .topbar .tb-label{color:#fff;opacity:.9;font-weight:600}
    .topbar .social{display:flex;gap:8px}
    .topbar .icon-btn{display:inline-flex;align-items:center;justify-content:center;width:40px;height:34px;border-radius:10px;border:1px solid rgba(255,255,255,.28);color:#fff;transition:.2s;background:transparent}
    .topbar .icon-btn:hover,.topbar .icon-btn:focus-visible{background:rgba(255,255,255,.12);border-color:rgba(255,255,255,.42);outline:none}
    .topbar .icon-btn svg{width:18px;height:18px;display:block}
    @media (max-width:640px){
      .row-warning-note{padding:10px 12px;white-space:normal}
      .topbar{font-size:.85rem}
      .topbar .tb-left{display:none}
      .topbar .container{flex-direction:row;gap:10px;padding:.60rem 8px;min-height:60px;align-items:center;justify-content:flex-end;text-align:right}
      .topbar .tb-right{margin-left:auto;flex-wrap:nowrap;justify-content:flex-end;gap:10px}
      .topbar .icon-btn{width:42px;height:36px}
    }
    @media (max-width:768px){ .topbar .tb-label{display:none} }

    header.nav{position:sticky;top:0;z-index:60;background:rgba(255,255,255,.9);backdrop-filter:saturate(160%) blur(8px);border-bottom:1px solid #eef1f6}
    .nav-row{display:flex;align-items:center;gap:16px;min-height:68px;flex-wrap:nowrap}
    .brand{display:flex;align-items:center;gap:12px;flex:0 0 auto}
    .logo-box{width:180px;height:48px;border-radius:10px;overflow:hidden}
    .logo{width:100%;height:100%;object-fit:contain}
    .menu{display:flex;gap:26px;align-items:center;margin-left:auto}
    .menu a{padding:10px 4px;font-weight:600;color:#243449}
    .menu a:hover{color:var(--c-primary)}
    .menu a.active{color:var(--c-primary)}
    .cta{flex:0 0 auto}
    header.nav .cta.btn{padding:.6rem 1.15rem}

    .burger{display:none;position:relative;width:44px;height:44px;border:2px solid #d4e2f7;border-radius:12px;background:#fff}
    .burger span{position:absolute;left:10px;right:10px;height:2px;background:#1b2b44;border-radius:2px;transition:.2s}
    .burger span:nth-child(1){top:14px}.burger span:nth-child(2){top:21px}.burger span:nth-child(3){top:28px}
    @media (max-width:960px){.menu,.cta{display:none}.burger{display:inline-block;margin-left:auto}}
    @media (max-width:420px){.logo-box{width:140px;height:38px}}

    body.nav-open{ overflow:hidden; }
    .overlay{
      display:none; position:fixed; left:0; right:0;
      top:var(--nav-offset); bottom:0;
      background:rgba(11,31,58,.55);
      z-index:9999; pointer-events:auto;
    }
    body.nav-open .overlay{ display:block; }
    .overlay-menu{
      position:fixed; right:12px; top:calc(var(--nav-offset) + 12px);
      width:min(92vw,420px); background:#fff; border-radius:16px; box-shadow:var(--shadow);
      padding:12px; display:flex; flex-direction:column; gap:6px; z-index:10000;
    }
    .overlay-menu a{display:block;padding:12px 14px;border-radius:10px}
    .overlay-menu a:not(.btn):hover{background:#f3f7ff}
    .overlay-menu .btn{display:flex;align-items:center;justify-content:center;padding:.7rem 1rem}

    main{padding:42px 0 18px}
    h1{margin:.2rem 0 .6rem;font-size:clamp(1.8rem,2.2vw+1rem,2.6rem)}
    .lead{color:#5f7187;max-width:none}
    .card{background:#fff;border:1px solid var(--c-border);border-radius:14px;box-shadow:var(--shadow);padding:16px}

    .search-card{padding:18px}
    .search-form{display:grid;grid-template-columns:minmax(0,1fr) minmax(180px,240px) auto;gap:.75rem;align-items:end}
    .search-actions{display:flex;align-items:end;gap:.6rem}
    .btn.danger-outline{border-color:#fca5a5;color:#b91c1c;background:#fff}
    .btn.danger-outline:hover{background:#fef2f2}
    .search-field label{display:block;font-weight:700;margin-bottom:.35rem}
    .search-field input{width:100%;height:var(--control-h);padding:0 .95rem;border-radius:12px;border:1px solid #cbd5e1;background:#fff;color:#0f172a}
    .search-field input:focus{outline:2px solid var(--c-primary);outline-offset:1px}
    .search-help{margin:.55rem 0 0;color:#64748b;font-size:.92rem}
    .status-line{margin:.85rem 0 0;min-height:1.35rem;font-size:.93rem}
    .status-line[data-tone="loading"]{color:#0f5db8}
    .status-line[data-tone="error"]{color:#b91c1c}
    .status-line[data-tone="success"]{color:#166534}

    .results-wrap{display:grid;gap:16px;margin-top:18px}
    .results-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap}
    .results-count{font-weight:700;color:#243449}
    .results-client{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
    .client-pill{
      display:inline-flex;align-items:center;padding:.45rem .75rem;border-radius:999px;
      border:1px solid #dbe7f8;background:#f8fbff;color:#17325a;font-size:.88rem;font-weight:700;
    }

    .manifest-card{border:1px solid var(--c-border);border-radius:16px;background:linear-gradient(180deg,#fff,#fbfdff);overflow:hidden}
    .manifest-summary{list-style:none;cursor:pointer;padding:16px 18px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;align-items:start}
    .manifest-summary::-webkit-details-marker{display:none}
    .manifest-title{display:flex;align-items:center;gap:10px;flex-wrap:nowrap;min-width:0}
    .manifest-title h2{margin:0;font-size:1.12rem}
    .manifest-badges{display:flex;gap:8px;flex-wrap:nowrap;min-width:0;align-items:center}
    .manifest-inline-alert{
      display:inline-flex;align-items:center;
      padding:.4rem .75rem;border-radius:999px;
      border:1px solid #fdba74;background:#fff7ed;color:#c2410c;
      font-size:.82rem;font-weight:700;
    }
    .chip{display:inline-flex;align-items:center;padding:.35rem .65rem;border-radius:999px;border:1px solid #d9e7fb;background:#eef5ff;color:#1d4f91;font-size:.8rem;font-weight:700}
    .chip.state-consolidando{background:#fff7ed;border-color:#fed7aa;color:#c2410c}
    .chip.state-en-transito{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}
    .chip.state-arribado{background:#ecfdf5;border-color:#bbf7d0;color:#15803d}
    .chip.state-entregado{background:#f0fdf4;border-color:#86efac;color:#166534}
    .chip.state-pendiente{background:#f8fafc;border-color:#cbd5e1;color:#475569}
    .progress-chip{
      display:inline-flex;align-items:center;gap:.55rem;padding:.35rem .7rem;
      border-radius:999px;border:1px solid #b7e4c7;background:#f0fdf4;color:#166534;
      font-size:.8rem;font-weight:800;
    }
    .transit-chip{
      display:inline-flex;align-items:center;gap:.45rem;padding:.35rem .7rem;
      border-radius:999px;border:1px solid #bfdbfe;background:#eff6ff;color:#1d4ed8;
      font-size:.8rem;font-weight:800;white-space:nowrap;text-decoration:none;
    }
    .transit-chip:hover{background:#dbeafe}

    .manifest-main{display:grid;gap:14px}
    .manifest-header-row{
      display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center;
    }
    .manifest-actions{display:flex;align-items:center;justify-content:flex-end;gap:12px}
    .manifest-meta{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
    .alert-note.alert-note--physical{
      border-color:#fcd34d;background:#fffbeb;color:#92400e;
    }
    .alert-note.alert-note--physical strong{color:#b45309}

    .whr-cell{display:inline-flex;align-items:center;gap:.38rem}
    .whr-warning-icon{
      display:inline-flex;align-items:center;justify-content:center;
      width:16px;height:16px;border-radius:999px;
      background:#fffbeb;border:1px solid #fcd34d;color:#f59e0b;
      vertical-align:middle;flex:0 0 auto;
    }
    .whr-warning-icon svg{width:11px;height:11px;display:block}
    .meta-box{padding:10px 12px;border-radius:12px;background:#f8fbff;border:1px solid #e2ebf8}
    .meta-box strong{display:block;color:#0f172a;font-size:.8rem;text-transform:uppercase;letter-spacing:.03em}
    .meta-box span{display:block;margin-top:.2rem;color:#334155;font-weight:600}
    .manifest-toggle{
      align-self:center;display:inline-flex;align-items:center;gap:.45rem;
      padding:.65rem .9rem;border-radius:999px;border:1px solid #d9e7fb;
      background:#f8fbff;color:#1d4f91;font-size:.88rem;font-weight:800;
      white-space:nowrap;
    }
    .manifest-toggle svg{
      width:16px;height:16px;display:block;transition:transform .2s ease;
    }
    .manifest-toggle .toggle-label-open{display:none}
    .manifest-card[open] .manifest-toggle .toggle-label-open{display:inline}
    .manifest-card[open] .manifest-toggle .toggle-label-closed{display:none}
    .manifest-card[open] .manifest-toggle svg{
      transform:rotate(180deg);
    }

    .manifest-body{border-top:1px solid var(--c-border);padding:0 18px 18px}
    .manifest-section{padding-top:16px}
    .section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin:0 0 10px}
    .section-label{margin:0;font-size:.95rem;font-weight:800;color:#163056}
    .manifest-section .section-label + .manifest-stats{margin-top:10px}
    .manifest-stats{display:flex;gap:10px;flex-wrap:wrap}
    .stat-pill{padding:.6rem .8rem;border-radius:12px;background:#f8fafc;border:1px solid #e2e8f0;color:#334155;font-size:.9rem;font-weight:600}
    .stat-pill .whr-warning-icon{position:relative;top:-1px}
    .alert-note{
      margin-top:12px;padding:12px 14px;border-radius:12px;
      border:1px solid #fed7aa;background:#fff7ed;color:#9a3412;
    }
    .alert-note strong{display:block;color:#c2410c;margin-bottom:.25rem}
    .alert-note .alert-copy{font-size:.9rem;line-height:1.45}

    .table-scroll{overflow:auto;border:1px solid var(--c-border);border-radius:14px}
    table{width:100%;border-collapse:collapse;min-width:760px;background:#fff}
    .manifest-table{table-layout:fixed}
    thead th{position:sticky;top:0;background:#f8fbff;color:#163056;font-size:.8rem;text-transform:uppercase;letter-spacing:.03em}
    th,td{padding:12px 10px;border-bottom:1px solid #eef2f7;text-align:left;vertical-align:middle}
    tbody td{font-size:.8rem;line-height:1.35}
    .manifest-table th[data-col="whr"],
    .manifest-table td[data-col="whr"]{width:8%}
    .manifest-table th[data-col="proveedor"],
    .manifest-table td[data-col="proveedor"]{width:22%;overflow-wrap:anywhere}
    .manifest-table th[data-col="descripcion"],
    .manifest-table td[data-col="descripcion"]{width:28%;overflow-wrap:anywhere}
    .manifest-table th[data-col="bultos"],
    .manifest-table td[data-col="bultos"]{width:8%;text-align:center;padding-left:4px;padding-right:24px}
    .manifest-table th[data-col="peso"],
    .manifest-table td[data-col="peso"]{width:10%;white-space:nowrap;text-align:center}
    .manifest-table th[data-col="cbm"],
    .manifest-table td[data-col="cbm"]{width:8%;white-space:nowrap;text-align:center}
    .manifest-table th[data-col="tracking"],
    .manifest-table td[data-col="tracking"]{width:20%;overflow-wrap:anywhere;padding-left:16px}
    .manifest-table th[data-col="factura"],
    .manifest-table td[data-col="factura"]{width:14%;overflow-wrap:anywhere}
    .manifest-table th[data-col="fecha"],
    .manifest-table td[data-col="fecha"]{width:10%;white-space:nowrap}
    tbody tr:hover{background:#fcfdff}
    /* Ocultas temporalmente por criterio operativo: se mantiene el total superior. */
    .manifest-table [data-col="peso"],
    .manifest-table [data-col="cbm"],
    .manifest-table [data-col="fecha"]{display:none}

    .factura-cell{display:inline-flex;align-items:center;gap:.42rem;flex-wrap:nowrap}
    .factura-wa{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;color:#16a34a;text-decoration:none;vertical-align:middle}
    .factura-wa svg{width:14px;height:14px;display:block}
    td small{display:block;color:#64748b}
    .pkg-desc{font-weight:600;color:#0f172a}
    .imo-chip{display:inline-flex;align-items:center;margin-left:.45rem;padding:.18rem .45rem;border-radius:999px;background:#b91c1c;color:#fff;font-size:.68rem;font-weight:700;line-height:1;text-transform:none;vertical-align:middle}
    .factura-estado{font-weight:700}
    .factura-estado.pendiente{color:#b91c1c}
    .factura-estado.recibido{color:#15803d}

    .empty-state,.error-state,.loading-state{padding:18px;border:1px dashed #cbd5e1;border-radius:14px;background:#fff;color:#475569}
    .empty-state strong,.error-state strong,.loading-state strong{display:block;color:#0f172a;margin-bottom:.35rem}
    .info-important-copy{font-size:.8rem;line-height:1.55}
    .info-important-copy .whr-warning-icon{margin:0 .22rem;vertical-align:-2px}
    .info-important-copy p{margin:0}

    footer{padding:18px 0;color:#5f7187}
    .brand-long{display:inline}.brand-short{display:none}
    @media (max-width:640px){.brand-long{display:none}.brand-short{display:inline}}

    .wa-fab{position:fixed; left:clamp(12px,2.4vw,24px); bottom:calc(14px + env(safe-area-inset-bottom, 0px)); z-index:85; display:block; width:clamp(52px,9.2vw,68px); line-height:0; border-radius:14px; filter:drop-shadow(0 6px 16px rgba(0,0,0,.18))}
    .wa-fab img{display:block;width:100%;height:auto;pointer-events:none}
    .wa-fab:focus-visible{outline:3px solid rgba(30,136,229,.5);outline-offset:3px}

    @media (max-width:840px){ .manifest-meta{grid-template-columns:repeat(2,minmax(0,1fr))} }
    @media (max-width:640px){
      .row-warning-note{padding:10px 12px;white-space:normal}
      .lead{font-size:.95rem;margin:0 0 .5rem}
      h1{font-size:clamp(1.35rem, 2.2vw + 1rem, 1.75rem);line-height:1.15;margin:.15rem 0 .35rem}
      main{padding:28px 0 12px}
      .card,.search-card{padding:12px}
      .search-form{grid-template-columns:1fr}
      .manifest-summary{grid-template-columns:1fr;gap:10px}
      .manifest-header-row{grid-template-columns:1fr}
      .manifest-title{flex-wrap:wrap}
      .mobile-columns-toggle{display:none}
      .manifest-table [data-col="proveedor"],.manifest-table [data-col="descripcion"]{display:none}
      .manifest-table td[data-col="tracking"]{padding-left:10px}
      .manifest-table td[data-col="factura"], .manifest-table th[data-col="factura"]{white-space:nowrap;width:18%}
      .factura-cell{white-space:nowrap;gap:.3rem}
      .factura-estado{font-size:.76rem}
      .manifest-badges{flex-wrap:wrap}
      .manifest-actions{justify-content:flex-start;flex-wrap:wrap}
      .manifest-meta{grid-template-columns:1fr}
      .manifest-body{padding:0 12px 12px}
      .manifest-summary{padding:14px 12px}
      .manifest-toggle{justify-self:start}
      .section-head{align-items:flex-start}
      .mobile-columns-toggle{display:inline-flex;align-items:center;justify-content:center;padding:.45rem .8rem;border:1px solid #cfe0ff;border-radius:999px;background:#fff;color:#1e5aa8;font-weight:700;font-size:.82rem;line-height:1;cursor:pointer}
      body.mobile-cols-expanded .manifest-table [data-col="proveedor"],body.mobile-cols-expanded .manifest-table [data-col="descripcion"]{display:table-cell}
    }
    @media (min-width:641px){.mobile-columns-toggle{display:none !important}}
    @media (min-width:961px){ .wa-fab{width:72px;bottom:20px;left:clamp(16px,2.2vw,28px)} }


