@font-face { font-family: Barlow; src: url(fonts/Barlow-Regular.ttf); font-weight: 400; }
@font-face { font-family: Barlow; src: url(fonts/Barlow-Medium.ttf); font-weight: 500; }
@font-face { font-family: Barlow; src: url(fonts/Barlow-SemiBold.ttf); font-weight: 600; }
@font-face { font-family: Barlow; src: url(fonts/Barlow-Bold.ttf); font-weight: 700; }
@font-face { font-family: 'Barlow Condensed'; src: url(fonts/BarlowCondensed-Bold.ttf); font-weight: 700; }
@font-face { font-family: 'Barlow Condensed'; src: url(fonts/BarlowCondensed-ExtraBold.ttf); font-weight: 800; }
:root { --rojo: #9b0d14; --rojo2: #7d0a10; --gris: #333; --gris2: #6b6b6b; --fondo: #f4f4f5; --linea: #e4e4e7; --ok: #1f6f43; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--fondo); color: var(--gris); font-family: Barlow, system-ui, sans-serif; font-size: 15px; line-height: 1.35; }
body { padding-bottom: calc(52px + env(safe-area-inset-bottom)); min-height: 100vh; }
.cond { font-family: 'Barlow Condensed', Barlow, sans-serif; }
/* Encabezado */
.top { display: flex; align-items: center; gap: 10px; background: #fff; padding: 7px 14px; border-bottom: 2px solid var(--rojo); position: sticky; top: 0; z-index: 5; }
.top-logo { height: 28px; width: auto; }
.top-t { font-family: 'Barlow Condensed'; font-weight: 700; font-size: 19px; color: var(--gris); line-height: 1.05; }
.top-s { font-size: 12px; color: var(--gris2); margin-top: 1px; }
main { padding: 12px 14px; max-width: 640px; margin: 0 auto; }
/* Pestañas */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #fff; border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs a { text-align: center; padding: 9px 0 10px; font-weight: 600; font-size: 13px; color: var(--gris2); text-decoration: none; border-top: 2px solid transparent; }
.tabs a.on { color: var(--rojo); border-top-color: var(--rojo); }
/* Tarjetas */
.card { background: #fff; border-radius: 8px; border: 1px solid var(--linea); overflow: hidden; margin-bottom: 10px; }
.card-h { background: #fff; color: var(--gris); padding: 8px 12px; font-weight: 700; font-size: 14.5px; border-top: 2px solid var(--rojo); border-bottom: 1px solid var(--linea); }
.card-h small { display: block; font-weight: 400; font-size: 12.5px; color: var(--gris2); }
.card-b { padding: 4px 12px 8px; }
.fila { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--linea); font-size: 14px; }
.fila:last-child { border-bottom: none; }
.fila b { font-weight: 600; font-size: 14.5px; text-align: right; }
.resul { background: #fbf2f2; border-top: 1px solid #efd9da; color: var(--rojo); text-align: center; padding: 7px 10px 8px; }
.resul .l { font-size: 11px; font-weight: 700; letter-spacing: .5px; opacity: .85; }
.resul .v { font-weight: 700; font-size: 18px; line-height: 1.15; }
.etiqueta-ej { display: inline-block; background: #fff3cd; color: #7a5b00; border: 1px solid #e6c55b; border-radius: 4px; font-size: 10.5px; font-weight: 700; padding: 0 5px; margin-left: 6px; vertical-align: middle; letter-spacing: 0; }
.aviso { background: #fff8e1; border: 1px solid #f0d27a; color: #6b5200; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 10px; }
/* Botones */
.btn { display: block; width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 10px 14px; font-family: Barlow, system-ui, sans-serif; font-weight: 600; font-size: 15px; text-align: left; margin-bottom: 8px; cursor: pointer; text-decoration: none; line-height: 1.25; }
.btn small { display: block; font-weight: 400; font-size: 12px; margin-top: 1px; opacity: .85; }
.btn-rojo { background: var(--rojo); color: #fff; }
.btn-gris { background: #3a3a3a; color: #fff; }
.btn-blanco { background: #fff; color: var(--gris); border-color: #d4d4d8; }
.btn-c { text-align: center; }
/* Lista de opciones (menú) */
.lista { background: #fff; border: 1px solid var(--linea); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--linea); color: inherit; text-decoration: none; min-height: 44px; }
.item:last-child { border-bottom: none; }
.item > div { flex: 1; min-width: 0; }
.item b { display: block; font-weight: 600; font-size: 14.5px; }
.item small { display: block; font-size: 12px; color: var(--gris2); }
.item::after { content: '›'; color: #b0b0b6; font-size: 18px; line-height: 1; }
.item.dest b { color: var(--rojo); }
/* Formularios */
label.campo { display: block; margin-bottom: 10px; }
label.campo span { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 3px; color: #4a4a4f; }
label.campo span i { font-style: normal; font-weight: 400; color: var(--gris2); }
input.in, textarea.in, select.in { width: 100%; font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid #cfcfd4; border-radius: 8px; background: #fff; color: var(--gris); }
textarea.in { min-height: 84px; resize: vertical; }
input.in:focus, textarea.in:focus, select.in:focus { outline: none; border-color: var(--rojo); }
.monto-box { display: flex; align-items: center; background: #fff; border: 1.5px solid var(--rojo); border-radius: 8px; padding: 3px 12px; }
.monto-box b { font-size: 22px; color: var(--rojo); margin-right: 6px; font-weight: 600; }
.monto-box input { border: none; font-weight: 700; font-size: 26px; width: 100%; color: var(--gris); background: transparent; font-family: inherit; }
.monto-box input:focus { outline: none; }
.tipos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.tipo { border: 1px solid #cfcfd4; background: #fff; border-radius: 8px; min-height: 42px; font-family: inherit; font-weight: 600; font-size: 14.5px; color: var(--gris); padding: 5px 6px; line-height: 1.15; cursor: pointer; }
.tipo small { display: block; font-weight: 400; font-size: 11px; opacity: .85; }
.tipo.abono { border-color: var(--ok); color: var(--ok); }
.tipo.sel { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.tipo.abono.sel { background: var(--ok); border-color: var(--ok); }
.foto { display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px dashed #b9b9be; border-radius: 8px; padding: 10px; background: #fafafa; font-weight: 500; font-size: 13.5px; color: var(--gris2); cursor: pointer; margin-bottom: 10px; }
.foto input { display: none; }
.foto img { max-height: 44px; border-radius: 4px; }
.sec { font-weight: 700; font-size: 13px; color: var(--gris); letter-spacing: .2px; margin: 14px 0 6px; }
.sec:first-child { margin-top: 2px; }
/* Historial */
.h-item { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; padding: 9px 12px; border-bottom: 1px solid var(--linea); }
.h-item:last-child { border-bottom: none; }
.h-t { font-weight: 600; font-size: 14.5px; }
.h-s { font-size: 12.5px; color: var(--gris2); }
.h-r { text-align: right; font-weight: 700; font-size: 14.5px; }
.h-r small { display: block; font-weight: 600; font-size: 10.5px; }
.pill { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 10px; margin-left: 6px; vertical-align: 1px; }
.pill.cerrada { background: #e8e8ea; color: #555; }
.pill.abierta { background: #fde7e8; color: var(--rojo); }
.movs .h-item { grid-template-columns: 1fr auto; }
/* Vista rendición (diseño TSM) */
.rend { background: #f1f1f2; border-radius: 14px; padding: 14px 12px 12px; border: 1px solid #ddd; position: relative; overflow: hidden; isolation: isolate; }
.rend-logo { display: block; width: 62%; margin: 0 auto; mix-blend-mode: multiply; }
.rend h2 { font-family: 'Barlow Condensed'; font-weight: 800; font-size: 31px; text-align: center; color: #333; line-height: 1; margin-top: 6px; }
.rend .sub { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; margin: 8px 0 12px; white-space: nowrap; }
.rend .sub i { flex: 1; height: 2px; background: var(--rojo); }
.rend .sub em { color: var(--rojo); font-style: normal; font-weight: 700; }
.r-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.r-card { background: #fff; border-radius: 8px; padding: 5px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.r-card .h { background: linear-gradient(#a8121a, var(--rojo2)); color: #fff; font-family: 'Barlow Condensed'; font-weight: 700; font-size: 14.5px; text-align: center; border-radius: 4px; padding: 4px 2px; white-space: nowrap; }
.r-card .f { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 4px 0; }
.r-card .f b { font-family: 'Barlow Condensed'; font-size: 15px; }
.r-card .r { margin-top: 6px; background: linear-gradient(#a8121a, var(--rojo2)); color: #fff; border-radius: 4px; padding: 4px 6px; text-align: center; font-family: 'Barlow Condensed'; font-weight: 700; font-size: 13px; line-height: 1.1; }
.r-card .r b { font-size: 18px; display: block; }
.r-panel { background: #fff; border: 1px solid #d9b3b5; border-radius: 10px; padding: 10px 10px 8px; margin-top: 10px; }
.r-panel .t { text-align: center; color: var(--rojo); font-family: 'Barlow Condensed'; font-weight: 800; font-size: 25px; line-height: 1; }
.r-panel .s { text-align: center; font-style: italic; color: #555; font-size: 12.5px; margin-bottom: 4px; }
.r-panel .pf { display: flex; justify-content: space-between; font-size: 14.5px; padding: 4px 2px; border-bottom: 1px solid #e6e6e6; }
.r-panel .pf.fu { font-weight: 700; border-bottom: none; }
.r-panel .sep { display: flex; align-items: center; gap: 8px; color: var(--rojo); font-weight: 700; font-size: 14px; margin: 4px 30px; }
.r-panel .sep::before, .r-panel .sep::after { content: ''; flex: 1; height: 2px; background: var(--rojo); }
.r-panel .it { display: grid; grid-template-columns: 16px 1fr auto; align-items: center; font-size: 13.5px; padding: 1px 18px; }
.r-panel .it i { width: 6px; height: 6px; border-radius: 50%; background: var(--rojo); }
.r-panel .tot { border-top: 1px solid #ccc; margin-top: 4px; }
.r-bar { margin-top: 8px; background: linear-gradient(#a8121a, var(--rojo2)); color: #fff; text-align: center; border-radius: 6px; padding: 6px; font-family: 'Barlow Condensed'; font-weight: 700; font-size: 17px; line-height: 1.05; }
.r-bar b { display: block; font-size: 32px; font-weight: 800; }
.r-foot { text-align: center; font-style: italic; font-size: 12px; color: #555; margin-top: 8px; }
.deco { position: absolute; width: 120px; height: 12px; background: var(--rojo); transform: rotate(-45deg); top: 10px; left: -38px; }
.deco.d2 { background: #3a3a3a; height: 6px; top: 30px; left: -46px; }
.toast { position: fixed; left: 14px; right: 14px; bottom: 64px; background: #222; color: #fff; padding: 10px 12px; border-radius: 8px; font-weight: 500; font-size: 13.5px; text-align: center; opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none; z-index: 9; }
.toast.on { opacity: 1; transform: none; }
.vacio { text-align: center; color: var(--gris2); padding: 14px; font-size: 13.5px; }
@media print { .top, .tabs, .no-print { display: none !important; } body { padding: 0; background: #fff; } main { padding: 0; max-width: none; } }

/* Liquidación */
.h-acc { grid-column: 1 / -1; }
.h-acc:empty { display: none; }
.btn-liq { margin-top: 6px; width: 100%; min-height: 34px; border: 1px solid var(--rojo); background: #fff; color: var(--rojo); border-radius: 6px; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.btn-liq.chico { margin-top: 5px; min-height: 30px; font-size: 11.5px; border-radius: 4px; }
.liq-ok { margin-top: 6px; font-size: 12.5px; color: var(--gris2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.r-card .liq-ok { font-size: 11px; margin-top: 5px; }
.lnk { background: none; border: none; color: var(--rojo); font: inherit; font-weight: 600; text-decoration: underline; padding: 6px 4px; cursor: pointer; }
.pill.liquidada { background: #e3f1e8; color: var(--ok); margin-left: 0; }
.h-item.liq .h-t, .h-item.liq .h-r { opacity: .6; }
.fila small.h-s { font-size: 11.5px; font-weight: 400; }
.r-vacio { grid-column: 1 / -1; text-align: center; color: var(--gris2); font-size: 13px; padding: 8px; background: #fff; border-radius: 6px; }
.r-nota { text-align: center; font-size: 11.5px; color: var(--gris2); margin-top: 6px; }
.lnk-datos { display: block; text-align: center; color: var(--gris2); font-size: 13px; padding: 6px 6px 2px; text-decoration: underline; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 2px 0 12px; }
.chk input { width: 18px; height: 18px; accent-color: var(--rojo); }

/* Indicador de sincronización */
.top-txt { flex: 1; min-width: 0; }
.sync { font-size: 11px; font-weight: 600; text-decoration: none; padding: 3px 7px 3px 17px; border-radius: 12px; position: relative; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.sync::before { content: ''; position: absolute; left: 7px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: currentColor; }
.sync.verde { background: #e3f1e8; color: var(--ok); }
.sync.ambar { background: #fff3cd; color: #8a6100; }
.sync.rojo { background: #fde7e8; color: var(--rojo); }
.sync.gris { background: #ececee; color: #666; }
.estado-con { font-size: 12.5px; color: var(--gris2); margin: -2px 0 8px; }

/* Camión */
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
select.in { appearance: none; background: #fff; }
.km-big { font-weight: 700; font-size: 28px; text-align: center; color: var(--rojo); line-height: 1.15; }
.doc-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; min-height: 44px; border-bottom: 1px solid var(--linea); color: inherit; text-decoration: none; }
.doc-row:last-child { border-bottom: none; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.badge.vigente { background: #e3f1e8; color: var(--ok); }
.badge.porvencer { background: #fff3cd; color: #8a6100; }
.badge.vencido { background: #fde7e8; color: var(--rojo); }
.badge.sinfecha, .badge.sincargar { background: #ececee; color: #666; }

/* Inicio de sesión, administración, rutas */
body.sin-sesion .tabs, body.sin-sesion #sync { display: none; }
body.sin-sesion { padding-bottom: 20px; }
.login-t { font-family: 'Barlow Condensed'; font-weight: 700; font-size: 24px; color: var(--gris); text-align: center; margin: 4px 0 10px; }
.con-det { margin-top: 14px; background: #fff; border: 1px solid var(--linea); border-radius: 8px; padding: 6px 12px; }
.con-det summary { font-weight: 600; font-size: 13.5px; color: var(--gris2); padding: 4px 0; cursor: pointer; }
.aviso-ses { background: #eef3f8; border-color: #c5d3e2; color: #2c3e50; }
#admin-estado.malo { background: #fde7e8; border-color: #e6a1a5; color: #7d0a10; }
.f-card { display: flex; gap: 10px; background: #fff; border-radius: 8px; border: 1px solid var(--linea); padding: 8px; margin-bottom: 8px; color: inherit; text-decoration: none; }
.f-img { width: 84px; height: 64px; flex: none; border-radius: 6px; object-fit: cover; background: #ececee; }
.f-body { flex: 1; min-width: 0; }
.f-top { display: flex; align-items: center; gap: 8px; }
.f-pat { font-weight: 700; font-size: 17px; color: var(--gris); letter-spacing: .5px; }
.f-bad { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
.f-bad:empty { display: none; }
.f-saldo { margin-top: 3px; font-size: 12.5px; color: var(--gris2); }
.ruta-d { border-bottom: 1px solid var(--linea); padding: 8px 12px; }
.ruta-d:last-child { border-bottom: none; }
.ruta-d summary { cursor: pointer; list-style: none; min-height: 36px; }
.ruta-d summary::-webkit-details-marker { display: none; }
.ruta-d[open] { background: #fafafa; }
.ruta-d .h-item { padding: 6px 0; }
.ph { background: #ececee url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40'%3E%3Cg fill='none' stroke='%23a3a3aa' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M6 28V12h24v16M30 17h13l7 7v4H30'/%3E%3Ccircle cx='16' cy='30' r='3.2' fill='%23ececee'/%3E%3Ccircle cx='42' cy='30' r='3.2' fill='%23ececee'/%3E%3C/g%3E%3C/svg%3E") center / 62% no-repeat; }
.foto-cam { width: 100%; max-height: 190px; height: 150px; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 8px; background: #ececee; }
.acc-d { background: #fff; border: 1px solid var(--linea); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.acc-d > summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; font-weight: 600; font-size: 14px; cursor: pointer; list-style: none; min-height: 40px; }
.acc-d > summary::-webkit-details-marker { display: none; }
.acc-d > summary::after { content: '›'; color: #b0b0b6; font-size: 18px; transition: transform .15s; }
.acc-d[open] > summary::after { transform: rotate(90deg); }
.acc-d > summary span { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--gris2); }
.acc-d[open] > summary { border-bottom: 1px solid var(--linea); }
.acc-d > .h-item:last-child, .acc-d > .doc-row:last-child { border-bottom: none; }
.cat { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: #ececee; color: #555; margin-right: 6px; }
.cat.Avería, .cat.Accidente { background: #fde7e8; color: var(--rojo); }
.cat.Retraso { background: #fff3cd; color: #8a6100; }
.mini { font-size: 12.5px; }
.btn-xs { border: 1px solid #d4d4d8; background: #fff; color: var(--gris2); border-radius: 6px; font: inherit; font-size: 12px; padding: 3px 8px; cursor: pointer; }
