    :root {
      color-scheme: light;
      --bg: #eef2f6;
      --side: #f5f7fb;
      --card: #ffffff;
      --card2: #eef4ff;
      --line: #dfe8f5;
      --ink: #0a1f3a;
      --mut: #617a94;
      --pri: #0e4de2;
      --pri2: #64d0ff;
      --ok: #3fbf8a;
      --warn: #e5a93d;
      --bad: #e0605e
    }

    * {
      box-sizing: border-box;
      scrollbar-color: #c3d1eb transparent
    }

    [hidden] {
      display: none !important
    }

    body {
      margin: 0;
      font: 14px/1.45 "Segoe UI Variable Text", "Segoe UI", -apple-system, "SF Pro Text", Inter, system-ui, sans-serif;
      background: var(--bg);
      color: var(--ink)
    }

    :focus-visible {
      outline: 2px solid var(--pri);
      outline-offset: 2px
    }

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

    .side {
      background: var(--side);
      border-right: 1px solid var(--line);
      padding: 18px 12px;
      display: flex;
      flex-direction: column;
      position: sticky;
      top: 0;
      height: 100vh;
      overflow-y: auto;
      gap: 10px
    }

    .side>* {
      flex-shrink: 0
    }

    .brand {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0;
      padding: 18px 12px 10px;
      min-height: 120px;
      margin-bottom: 4px
    }

    .mk {
      position: relative;
      width: 140px;
      height: 140px;
      flex: none;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: visible;
      filter: drop-shadow(0 10px 18px rgba(32, 97, 215, .18))
    }

    .mk img {
      display: block;
      width: 140px;
      height: 140px;
      object-fit: contain;
      user-select: none;
      pointer-events: none
    }

    .wordmark {
      display: flex;
      align-items: center;
      justify-content: center;
      flex: 0 0 auto;
      line-height: 0;
      margin-top: -8px
    }

    .wordmark img {
      display: block;
      width: auto;
      height: 54px;
      object-fit: contain;
      user-select: none;
      pointer-events: none
    }

    .brand b {
      display: block;
      font-size: 32px;
      line-height: 1;
      letter-spacing: -2px;
      font-weight: 900;
      color: #071f3d;
      transform: scaleY(1.06);
      margin: 0
    }

    nav {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 8px
    }

    nav h4 {
      margin: 12px 10px 8px;
      font-size: 11.5px;
      font-weight: 600;
      color: #5f6d87;
      letter-spacing: .04em
    }

    nav button {
      display: flex;
      gap: 11px;
      align-items: center;
      width: 100%;
      padding: 10px 12px;
      margin: 0;
      background: none;
      border: 0;
      border-left: 3px solid transparent;
      border-radius: 8px;
      color: var(--mut);
      font: inherit;
      cursor: pointer;
      text-align: left;
      transition: all .15s ease
    }

    nav button:hover {
      background: linear-gradient(90deg, rgba(14, 77, 226, .09), rgba(100, 208, 255, .06));
      color: var(--ink);
      box-shadow: inset 0 0 0 1px rgba(14, 77, 226, .05)
    }

    nav button.on {
      background: linear-gradient(90deg, rgba(14, 77, 226, .12), rgba(100, 208, 255, .06));
      border-left-color: var(--pri);
      color: var(--ink);
      box-shadow: inset 0 0 0 1px rgba(14, 77, 226, .06)
    }

    nav svg {
      width: 18px;
      height: 18px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.7;
      stroke-linecap: round;
      stroke-linejoin: round;
      flex: none
    }

    .nav-actions {
      margin-top: 16px;
      padding-top: 12px;
      border-top: 1px solid var(--line);
      display: grid;
      gap: 8px
    }

    .nav-actions .btn {
      width: 100%;
      justify-content: center;
      text-align: center
    }

    .foot {
      margin-top: auto;
      padding: 14px 10px 0;
      color: #55627c;
      font-size: 11.5px
    }

    .login-shell {
      position: fixed;
      inset: 0;
      z-index: 10;
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(380px, 520px);
      overflow-y: auto;
      background: #f4f8fc
    }

    .login-hero {
      position: relative;
      background: #eef5fb url('/img/login-bg.png') center / cover no-repeat
    }

    .login-hero::after {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, transparent 75%, rgba(244, 248, 252, .85))
    }

    .login-side {
      position: relative;
      display: grid;
      place-items: center;
      padding: 40px 32px;
      background: linear-gradient(180deg, #fff, #f4f8fc);
      box-shadow: -12px 0 40px rgba(17, 42, 76, .08)
    }

    .login-panel {
      width: 100%;
      max-width: 380px
    }

    .login-logo {
      display: block;
      width: 56px;
      height: 56px;
      object-fit: contain;
      margin-bottom: 18px
    }

    .login-panel h2 {
      font-size: 26px;
      font-weight: 700;
      letter-spacing: -.01em
    }

    .login-panel .sub {
      margin: 6px 0 22px
    }

    .login-panel label {
      margin-top: 16px;
      font-size: 13px;
      font-weight: 600;
      color: var(--ink)
    }

    .login-panel input,
    .login-panel select {
      margin-top: 6px;
      padding: 11px 12px;
      background: #fff;
      border-radius: 8px
    }

    .pw {
      position: relative;
      display: block;
      margin-top: 6px
    }

    .login-panel .pw input {
      margin-top: 0;
      padding-right: 84px
    }

    .pw-tg {
      position: absolute;
      top: 50%;
      right: 6px;
      transform: translateY(-50%);
      padding: 6px 10px;
      background: none;
      border: 0;
      border-radius: 6px;
      color: var(--pri);
      font: inherit;
      font-size: 12.5px;
      font-weight: 600;
      cursor: pointer
    }

    .pw-tg:hover {
      background: var(--card2)
    }

    .login-caps {
      margin: 6px 0 0;
      font-size: 12px;
      color: #9a6400
    }

    .login-err {
      margin: 16px 0 0;
      padding: 10px 12px;
      background: #fdecec;
      border: 1px solid #f5c2c1;
      border-radius: 8px;
      color: #a12b2a;
      font-size: 13px
    }

    .login-btn {
      width: 100%;
      margin-top: 22px;
      padding: 12px;
      border-radius: 8px;
      font-size: 15px;
      box-shadow: 0 6px 16px rgba(14, 77, 226, .25)
    }

    .login-btn:hover {
      background: #2a64ea
    }

    .login-btn:disabled {
      opacity: .7;
      cursor: progress
    }

    .login-foot {
      margin: 28px 0 0;
      text-align: center;
      color: var(--mut);
      font-size: 12px
    }

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

      .login-hero {
        background: #f4f8fc
      }

      .login-hero::after {
        top: 0;
        right: auto;
        bottom: 20px;
        left: 50%;
        aspect-ratio: 1;
        transform: translateX(-50%);
        background: url('/img/login-bg.png') center / cover no-repeat;
        -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent);
        mask-image: radial-gradient(closest-side, #000 72%, transparent)
      }

      .login-logo {
        display: none
      }

      .login-side {
        place-items: start center;
        margin-top: -20px;
        padding: 28px 20px 40px;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 24px rgba(17, 42, 76, .08)
      }
    }

    main {
      padding: 28px 36px;
      min-width: 0
    }

    h2 {
      margin: 0;
      font-size: 22px;
      font-weight: 600
    }

    .sub {
      margin: 3px 0 0;
      color: var(--mut)
    }

    .bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 18px;
      gap: 10px;
      flex-wrap: wrap
    }

    .bar>div+div,
    .bar>span {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center
    }

    .bar input {
      margin: 0
    }

    .tw {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 10px;
      overflow-x: auto;
      margin-top: 10px
    }

    table {
      width: 100%;
      border-collapse: collapse
    }

    th {
      background: var(--card2);
      color: var(--mut);
      font-weight: 600;
      font-size: 12px;
      padding: 11px 14px;
      text-align: left;
      border-bottom: 1px solid var(--line);
      white-space: nowrap
    }

    td {
      padding: 11px 14px;
      border-bottom: 1px solid var(--line);
      vertical-align: middle
    }

    tr:last-child td {
      border-bottom: 0
    }

    @media(hover:hover) {
      tbody tr:hover td {
        background: #f5f9ff
      }
    }

    td:last-child {
      text-align: right;
      white-space: nowrap
    }

    td[data-l="Fecha"],
    td[data-l="N°"] {
      white-space: nowrap
    }

    td.empty {
      padding: 32px 14px;
      text-align: center;
      white-space: normal;
      color: var(--mut)
    }

    td.empty .btn {
      margin-left: 8px
    }

    tfoot td {
      font-weight: 700;
      background: var(--card2);
      border-top: 1px solid var(--line)
    }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      background: var(--pri);
      color: #fff;
      border: 1px solid transparent;
      padding: 8px 14px;
      border-radius: 6px;
      cursor: pointer;
      font: inherit;
      font-weight: 600;
      text-decoration: none;
      white-space: nowrap;
      transition: background .15s, border-color .15s
    }

    .btn:hover {
      background: #2a64ea
    }

    .btn:disabled {
      opacity: .65;
      cursor: progress
    }

    .btn.g {
      background: transparent;
      color: var(--ink);
      border-color: var(--line);
      font-weight: 500
    }

    .btn.g:hover {
      background: var(--card2);
      border-color: #b9c9e4
    }

    .btn.d {
      background: #d64545
    }

    .btn.d:hover {
      background: #b93434
    }

    .btn.g.d {
      background: transparent;
      color: #b93434
    }

    .btn.g.d:hover {
      background: #fdecec;
      border-color: #f5c2c1
    }

    td .btn {
      padding: 4px 10px;
      font-size: 12.5px
    }

    .bd {
      display: inline-block;
      padding: 2px 10px;
      border-radius: 99px;
      font-size: 12px;
      font-weight: 600;
      background: #e6efff;
      color: #1b4fc4
    }

    .bd.b2 {
      background: #fff3dc;
      color: #8a5a00
    }

    .bd.b3 {
      background: #dff6ec;
      color: #1d7a52
    }

    .bd.b4 {
      background: #fde6e6;
      color: #b42f2d
    }

    .q {
      width: 220px
    }

    .bar input[type=date] {
      width: auto
    }

    .loading,
    .empty-st {
      display: grid;
      justify-items: center;
      gap: 10px;
      padding: 80px 20px;
      color: var(--mut);
      text-align: center
    }

    .empty-st b {
      color: var(--ink);
      font-size: 16px
    }

    .loading i {
      width: 28px;
      height: 28px;
      border: 3px solid var(--line);
      border-top-color: var(--pri);
      border-radius: 50%;
      animation: gira .8s linear infinite
    }

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

    .ferr {
      margin: 14px 0 0;
      padding: 10px 12px;
      background: #fdecec;
      border: 1px solid #f5c2c1;
      border-radius: 8px;
      color: #a12b2a;
      font-size: 13px
    }

    .bar.acts {
      justify-content: flex-end;
      margin: 18px 0 0
    }

    .lnk {
      width: 100%;
      margin-top: 14px
    }

    #T {
      inset: auto 16px 16px auto;
      margin: 0;
      padding: 0;
      border: 0;
      background: none;
      overflow: visible;
      display: grid;
      gap: 8px;
      width: min(360px, calc(100vw - 32px))
    }

    #T:not(:popover-open) {
      display: none
    }

    .toast {
      padding: 12px 16px;
      border-radius: 10px;
      background: #0f2a4d;
      color: #fff;
      font-size: 13.5px;
      box-shadow: 0 10px 30px rgba(10, 31, 58, .25);
      border-left: 4px solid var(--ok);
      animation: entra .2s ease-out;
      transition: opacity .3s, transform .3s
    }

    .toast.err {
      background: #4a1717;
      border-left-color: var(--bad)
    }

    .toast.out {
      opacity: 0;
      transform: translateY(8px)
    }

    @keyframes entra {
      from {
        opacity: 0;
        transform: translateY(8px)
      }
    }

    .topbar,
    .scrim {
      display: none
    }

    .board {
      display: grid;
      grid-template-columns: repeat(4, minmax(230px, 1fr));
      gap: 14px;
      align-items: start;
      overflow-x: auto
    }

    .col {
      background: var(--card);
      border: 1px solid var(--line);
      border-top: 3px solid var(--pri);
      border-radius: 10px;
      padding: 10px;
      min-height: 340px
    }

    .col[data-e="En ruta"] {
      border-top-color: var(--warn)
    }

    .col[data-e=Entregado] {
      border-top-color: var(--ok)
    }

    .col[data-e=Cancelado] {
      border-top-color: var(--bad)
    }

    .ch {
      display: flex;
      align-items: center;
      gap: 8px;
      font-weight: 600;
      padding: 2px 4px 6px
    }

    .ch i {
      margin-left: auto;
      font-style: normal;
      background: var(--card2);
      border-radius: 99px;
      padding: 0 9px;
      color: var(--mut);
      font-size: 12px
    }

    .col.over {
      background: var(--card2)
    }

    .card {
      background: var(--card2);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 10px 12px;
      margin-top: 8px;
      cursor: grab;
      line-height: 1.5;
      transition: border-color .15s, box-shadow .15s
    }

    .card:hover {
      border-color: var(--pri);
      box-shadow: 0 4px 12px rgba(14, 77, 226, .08)
    }

    .card b,
    .card span,
    .card small {
      display: block
    }

    .card small {
      color: var(--mut)
    }

    .vacio {
      margin: 8px 0 0;
      padding: 18px 8px;
      border: 1px dashed var(--line);
      border-radius: 8px;
      color: var(--mut);
      text-align: center;
      font-size: 12.5px
    }

    .kpis {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 14px;
      margin-bottom: 18px
    }

    .kpi {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 16px 18px
    }

    .kpi span {
      color: var(--mut);
      font-size: 12.5px
    }

    .kpi b {
      display: block;
      font-size: 24px;
      font-weight: 600;
      margin-top: 4px
    }

    .kpi .up {
      color: var(--ok)
    }

    .panel {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 22px 24px;
      max-width: 860px
    }

    .panel ol {
      color: var(--mut);
      line-height: 1.75;
      padding-left: 20px
    }

    .panel ol b {
      color: var(--ink)
    }

    .panel a {
      color: var(--pri)
    }

    label {
      display: block;
      margin-top: 12px;
      font-size: 12.5px;
      color: var(--mut)
    }

    input,
    select,
    textarea {
      width: 100%;
      margin-top: 4px;
      padding: 8px 10px;
      background: var(--bg);
      color: var(--ink);
      border: 1px solid var(--line);
      border-radius: 6px;
      font: inherit
    }

    input:focus,
    select:focus,
    textarea:focus {
      outline: none;
      border-color: var(--pri);
      box-shadow: 0 0 0 3px #3b8bf033
    }

    dialog {
      background: var(--card);
      color: var(--ink);
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 22px;
      width: min(580px, 95vw);
      max-height: calc(100vh - 32px);
      overflow: auto;
      box-shadow: 0 24px 60px rgba(10, 31, 58, .3)
    }

    dialog::backdrop {
      background: rgba(10, 31, 58, .45);
      backdrop-filter: blur(3px)
    }

    dialog .sub {
      margin-bottom: 4px
    }

    dialog .tw {
      max-height: 55vh;
      overflow: auto
    }

    dialog h3 {
      margin: 0 0 6px;
      font-size: 17px
    }

    .tl .ev {
      border-left: 2px solid var(--line);
      padding: 2px 0 12px 14px
    }

    .tl .ev p {
      margin: 4px 0 0;
      color: var(--mut)
    }

    .tl small {
      color: var(--mut);
      margin-left: 6px
    }

    #its .it,
    .it {
      display: grid;
      grid-template-columns: 1fr 72px 112px 34px;
      gap: 6px;
      margin-top: 6px
    }

    .it input {
      margin: 0
    }

    .it .btn {
      padding: 4px
    }

    #tot {
      font-size: 16px
    }

    @media(max-width:900px) {
      .app {
        display: block
      }

      .topbar {
        position: sticky;
        top: 0;
        z-index: 5;
        display: flex;
        align-items: center;
        gap: 10px;
        height: 56px;
        padding: 0 12px;
        padding-top: env(safe-area-inset-top);
        background: rgba(245, 247, 251, .92);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--line)
      }

      .menu {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        background: none;
        border: 0;
        border-radius: 8px;
        color: var(--ink);
        cursor: pointer
      }

      .menu:hover {
        background: var(--card2)
      }

      .menu svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round
      }

      .tb-logo {
        width: 28px;
        height: 28px;
        object-fit: contain
      }

      #ttl {
        font-size: 16px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis
      }

      .side {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 8;
        width: min(280px, 84vw);
        height: 100%;
        transform: translateX(-100%);
        transition: transform .22s ease, box-shadow .22s
      }

      .nav-open {
        overflow: hidden
      }

      .nav-open .side {
        transform: none;
        box-shadow: 8px 0 30px rgba(10, 31, 58, .18)
      }

      .scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 7;
        background: rgba(10, 31, 58, .4);
        opacity: 0;
        pointer-events: none;
        transition: opacity .22s
      }

      .nav-open .scrim {
        opacity: 1;
        pointer-events: auto
      }

      .brand {
        min-height: 0;
        padding: 6px 12px 0
      }

      .mk,
      .mk img {
        width: 80px;
        height: 80px
      }

      .wordmark img {
        height: 36px
      }

      main {
        padding: 18px 16px calc(24px + env(safe-area-inset-bottom))
      }

      .board {
        grid-template-columns: repeat(4, min(300px, 82vw));
        scroll-snap-type: x mandatory;
        padding-bottom: 8px
      }

      .col {
        scroll-snap-align: start;
        min-height: 220px
      }

      main .tw {
        background: none;
        border: 0;
        overflow: visible
      }

      main .tw table,
      main .tw tr,
      main .tw td {
        display: block
      }

      main .tw tbody {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 10px
      }

      main .tw thead {
        display: none
      }

      main .tw tr {
        display: flex;
        flex-direction: column;
        padding: 6px 14px;
        background: var(--card);
        border: 1px solid var(--line);
        border-radius: 12px
      }

      main .tw tr:has(.empty) {
        grid-column: 1 / -1
      }

      main .tw td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px dashed var(--line);
        text-align: right;
        white-space: normal;
        overflow-wrap: anywhere
      }

      main .tw td::before {
        content: attr(data-l);
        flex: none;
        color: var(--mut);
        font-size: 12.5px;
        text-align: left
      }

      main .tw td:first-child {
        font-weight: 600
      }

      main .tw td.ac {
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
        margin-top: auto;
        padding-top: 12px;
        border-bottom: 0
      }

      main .tw td.ac::before,
      main .tw td.empty::before {
        display: none
      }

      main .tw td.ac .btn {
        flex: 1 1 auto;
        min-height: 38px
      }

      main .tw td.empty {
        display: block;
        border: 0;
        text-align: center;
        font-weight: 400
      }

      main .tw td.empty .btn {
        display: flex;
        margin: 12px auto 0
      }
    }

    @media(max-width:700px) {
      h2 {
        font-size: 20px
      }

      .bar>div+div {
        width: 100%
      }

      .bar>div+div>* {
        flex: 1 1 auto
      }

      .bar .q,
      .bar input[type=date] {
        flex: 1 1 100%;
        width: 100%
      }

      .btn {
        min-height: 40px
      }

      input,
      select,
      textarea {
        font-size: 16px;
        padding: 10px 12px
      }

      .kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px
      }

      .kpi {
        padding: 12px 14px
      }

      .kpi b {
        font-size: 18px;
        overflow-wrap: anywhere
      }

      dialog {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        margin: auto 0 0;
        padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
        border: 0;
        border-radius: 18px 18px 0 0
      }

      .bar.acts>* {
        flex: 1 1 auto
      }

      #its .it {
        grid-template-columns: 1fr 1fr 40px;
        padding: 8px;
        background: var(--bg);
        border-radius: 8px
      }

      #its .it [data-k=desc] {
        grid-column: 1 / -1
      }

      #its .it input {
        background: var(--card)
      }

      #T {
        inset: auto 16px calc(16px + env(safe-area-inset-bottom)) 16px;
        width: auto
      }
    }
