/* TallerPass · interfaz de la app (taller, cliente y administración) */
@font-face { font-family: "Archivo"; src: url("/fonts/archivo.woff") format("woff"); font-weight: 400 600; font-display: swap; }

:root {
  --c: #1f3a93;                                   /* color de marca del taller */
  --c-suave: color-mix(in srgb, var(--c) 9%, white);
  --c-borde: color-mix(in srgb, var(--c) 28%, white);
  --c-hover: color-mix(in srgb, var(--c) 86%, black);
  --fondo: #f2f2ef;
  --tarjeta: #ffffff;
  --hundido: #f7f7f5;
  --texto: #18191d;
  --gris: #5d5f68;
  --gris-2: #8a8c95;
  --borde: #e1e1dc;
  --ok: #157347;       --ok-suave: #e5f3ea;
  --alerta: #9a4a06;   --alerta-suave: #fbf0de;
  --error: #b42318;    --error-suave: #fcebe9;
  --r: 12px;
  --r-ctrl: 10px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --t-small: 0.8125rem;   /* 13px */
  --t-meta: 0.875rem;     /* 14px */
  --t-body: 1rem;         /* 16px */
  --t-lead: 1.25rem;      /* 20px */
  --t-head: 1.625rem;     /* 26px */
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; background: var(--fondo); }
body {
  margin: 0; background: var(--fondo); color: var(--texto); caret-color: var(--c);
  font: 400 var(--t-body)/1.5 "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "lnum" 1;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}
::selection { background: var(--c); color: #fff; }
:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: #c9c9c3 transparent; }
a { color: var(--c); text-underline-offset: 3px; }
h1 { font-size: var(--t-head); font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; margin: 0 0 4px; }
h2 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.005em; margin: 0 0 12px; }
h3 { font-size: var(--t-meta); font-weight: 600; margin: 20px 0 8px; color: var(--gris); }
p { margin: 0 0 8px; }
.oculto { display: none !important; }
.contenedor { max-width: 760px; margin: 0 auto; padding: 16px; }
.ico { width: 1.15em; height: 1.15em; flex: 0 0 auto; vertical-align: -0.2em; }

/* barra superior */
.barra {
  background: var(--c); color: #fff; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px; min-height: 56px;
}
.barra .titulo { font-weight: 600; font-size: var(--t-body); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra .sub { display: block; font-weight: 400; font-size: var(--t-small); opacity: .82; overflow: hidden; text-overflow: ellipsis; }
.barra img.logo { height: 36px; width: auto; max-width: 92px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; flex-shrink: 0; }
.barra a, .barra button.icono {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; min-width: 40px; justify-content: center;
  color: #fff; text-decoration: none; background: rgba(255,255,255,.14); border: 0; border-radius: 10px;
  padding: 0 12px; font: inherit; font-size: var(--t-meta); font-weight: 600; cursor: pointer; flex-shrink: 0;
  transition: background-color 140ms ease, transform 120ms var(--ease);
}
.barra a:active, .barra button.icono:active { transform: scale(.96); background: rgba(255,255,255,.24); }
.barra a .ico { width: 18px; height: 18px; }
.barra a.cuentas { background: #fff; color: var(--c); }
.barra a.cuentas:active { background: rgba(255,255,255,.85); }
.barra a.cuentas .ico { width: 16px; height: 16px; }
@media (max-width: 350px) { .barra a.cuentas { font-size: 0; gap: 0; } .barra a.cuentas .ico { width: 18px; height: 18px; } }

/* tarjetas: superficies separadas por tono, sin bordes duros */
.tarjeta { background: var(--tarjeta); border-radius: var(--r); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(24, 25, 29, .05); }
.tarjeta > h2:first-child { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.paso { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--c-suave); color: var(--c); font-size: var(--t-meta); font-weight: 600; font-variant-numeric: tabular-nums; }

/* formularios */
label { display: block; font-size: var(--t-meta); font-weight: 600; color: var(--gris); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--texto); background: var(--hundido);
  border: 1px solid var(--borde); border-radius: var(--r-ctrl); padding: 11px 12px; outline: none; min-height: 46px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
input::placeholder, textarea::placeholder { color: var(--gris-2); }
input:focus, select:focus, textarea:focus { border-color: var(--c); background: #fff; box-shadow: 0 0 0 3px var(--c-suave); }
input:disabled, select:disabled, textarea:disabled { color: var(--gris); background: #ececea; }
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
input[type="color"] { padding: 4px; }
.fila { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.fila3 { display: grid; grid-template-columns: 72px 1fr 1fr; gap: 0 10px; }
@media (max-width: 520px) { .fila { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--texto); font-size: var(--t-body); cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 0; flex: 0 0 22px; margin-top: 1px; accent-color: var(--c); }
.ayuda { font-size: var(--t-meta); color: var(--gris); margin: 6px 0 0; }

/* botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  font: inherit; font-weight: 600; font-size: var(--t-body); border-radius: var(--r-ctrl); border: 0;
  padding: 0 18px; min-height: 48px; cursor: pointer; text-decoration: none; background: var(--c); color: #fff;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform 120ms var(--ease), background-color 140ms ease, opacity 140ms ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: progress; transform: none; }
.btn.sec { background: var(--c-suave); color: var(--c); }
.btn.peligro { background: var(--error-suave); color: var(--error); }
.btn.wa { background: #1c9b4f; }
.btn.ok { background: var(--ok); }
.btn.bloque { width: 100%; }
.btn.chico { padding: 0 12px; min-height: 38px; font-size: var(--t-meta); border-radius: 9px; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--c-hover); }
  .btn.sec:hover { background: color-mix(in srgb, var(--c) 15%, white); }
  .btn.peligro:hover { background: #f8d9d5; }
  .btn.wa:hover { background: #178544; }
  .btn.ok:hover { background: #10603a; }
  .barra a:hover, .barra button.icono:hover { background: rgba(255,255,255,.22); }
  .orden-item:hover { background: #fcfcfb; }
}
.botones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.fijo-abajo {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--fondo); padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -1px 0 var(--borde), 0 -8px 24px rgba(24, 25, 29, .06);
}
.fijo-abajo .contenedor { padding: 0; display: flex; gap: 8px; }
.fijo-abajo .btn { flex: 1; min-height: 52px; }

/* chips de estado */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: var(--t-small); font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--c-suave); color: var(--c); white-space: nowrap; flex-shrink: 0; line-height: 1.4; }
.chip .ico { width: 13px; height: 13px; }
.chip.ok { background: var(--ok-suave); color: var(--ok); }
.chip.alerta { background: var(--alerta-suave); color: var(--alerta); }
.chip.gris { background: #ebebe7; color: var(--gris); }
.chip.error { background: var(--error-suave); color: var(--error); }

/* lista de órdenes */
.buscar { display: flex; gap: 8px; margin-bottom: 10px; position: relative; }
.buscar input { padding-left: 40px; background: var(--tarjeta); }
.buscar::before { content: ""; position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); background: var(--gris-2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat; pointer-events: none; }
.filtros { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin: 0 -16px 8px; padding-inline: 16px; scrollbar-width: none; overscroll-behavior-x: contain; }
.filtros::-webkit-scrollbar { display: none; }
.filtros button {
  flex: 0 0 auto; border: 0; background: var(--tarjeta); border-radius: 99px; padding: 8px 14px; min-height: 38px;
  font: inherit; font-size: var(--t-meta); font-weight: 600; cursor: pointer; color: var(--gris); user-select: none;
  touch-action: manipulation; transition: background-color 140ms ease, color 140ms ease, transform 120ms var(--ease);
}
.filtros button:active { transform: scale(.96); }
.filtros button.activo { background: var(--c); color: #fff; }
.tarjeta .filtros { margin-inline: -16px; }
.tarjeta .filtros button { background: var(--hundido); }
.tarjeta .filtros button:active { background: var(--c-suave); color: var(--c); }
.orden-item {
  display: block; text-decoration: none; color: inherit; background: var(--tarjeta); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 8px; box-shadow: 0 1px 2px rgba(24,25,29,.05);
  transition: transform 120ms var(--ease), background-color 140ms ease;
}
.orden-item:active { transform: scale(.985); }
.orden-item .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.orden-item .num { font-weight: 600; color: var(--c); font-variant-numeric: tabular-nums; font-size: var(--t-meta); }
.orden-item .cli { font-weight: 600; font-size: 1.0625rem; margin-top: 2px; overflow-wrap: anywhere; }
.orden-item .eq { color: var(--gris); font-size: var(--t-meta); overflow-wrap: anywhere; }
.orden-item .flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.vacio { text-align: center; color: var(--gris); padding: 48px 16px; }
.vacio .ico { width: 40px; height: 40px; color: var(--gris-2); display: block; margin: 0 auto 12px; }
.vacio b { display: block; color: var(--texto); font-size: var(--t-lead); font-weight: 600; margin-bottom: 4px; }

/* equipos */
.equipo { background: var(--hundido); border-radius: var(--r-ctrl); padding: 4px 12px 12px; margin-bottom: 10px; position: relative; }
.equipo .quitar { position: absolute; right: 8px; top: 8px; }

/* fotos */
.fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-top: 12px; }
.foto { position: relative; border-radius: 10px; overflow: hidden; background: #e7e7e3; aspect-ratio: 4 / 3; }
.foto img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.foto .x { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.62); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.foto .nota { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.62); color: #fff; font-size: var(--t-small); padding: 4px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foto.subiendo::after { content: "Subiendo…"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.75); font-size: var(--t-small); font-weight: 600; }
.subir-fotos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.subir-fotos label { margin: 0; color: var(--c); }
.subir-fotos input { display: none; }

/* datos */
.datos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.datos div { min-width: 0; }
.datos div span { display: block; font-size: var(--t-small); font-weight: 600; color: var(--gris); }
.datos div b { font-weight: 400; overflow-wrap: anywhere; }
.datos .ancho { grid-column: 1 / -1; }
.texto-largo { white-space: pre-wrap; overflow-wrap: anywhere; }
table.eq { width: 100%; border-collapse: collapse; font-size: var(--t-meta); }
table.eq th { text-align: left; font-size: var(--t-small); font-weight: 600; color: var(--gris); padding: 6px 6px; background: var(--hundido); }
table.eq td { padding: 9px 6px; border-bottom: 1px solid var(--borde); vertical-align: top; overflow-wrap: break-word; }
table.eq td:first-child { font-variant-numeric: tabular-nums; }

/* línea de tiempo */
.tiempo { list-style: none; margin: 0; padding: 0; }
.tiempo li { position: relative; padding: 0 0 16px 26px; }
.tiempo li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.tiempo li::after { content: ""; position: absolute; left: 9px; top: 21px; bottom: 2px; width: 2px; border-radius: 1px; background: var(--borde); }
.tiempo li:last-child::after { display: none; }
.tiempo li + li::before { background: var(--c-borde); }
.tiempo .cuando { font-size: var(--t-small); color: var(--gris); font-variant-numeric: tabular-nums; }
.tiempo .que { font-weight: 600; }
.tiempo .privada { font-size: var(--t-small); color: var(--alerta); }

/* avisos */
.aviso { border-radius: var(--r); padding: 12px 14px; font-size: var(--t-meta); margin-bottom: 12px; background: var(--c-suave); color: color-mix(in srgb, var(--c) 70%, black); }
.aviso.alerta { background: var(--alerta-suave); color: #6e3404; }
.aviso.ok { background: var(--ok-suave); color: #0b4a2c; }
.aviso.error { background: var(--error-suave); color: #7d1810; }
.aviso b { display: block; margin-bottom: 2px; font-size: var(--t-body); }
.aviso a { color: inherit; font-weight: 600; }

/* firma */
.firma-caja { border: 2px dashed var(--c-borde); border-radius: var(--r-ctrl); background: #fff; position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
.firma-caja canvas { width: 100%; height: 180px; display: block; }
.firma-caja .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--gris-2); pointer-events: none; font-size: var(--t-meta); }
.firma-guardada { border: 1px solid var(--borde); border-radius: var(--r-ctrl); background: #fff; height: 120px; display: grid; place-items: center; padding: 8px; }
.firma-guardada img { max-height: 102px; max-width: 100%; object-fit: contain; }
.firma-caja .linea { position: absolute; left: 20px; right: 20px; bottom: 36px; border-bottom: 1px solid var(--borde); pointer-events: none; }

/* condiciones */
.condiciones { max-height: 280px; overflow-y: auto; overscroll-behavior: contain; font-size: var(--t-meta); line-height: 1.55; white-space: pre-wrap; background: var(--hundido); border-radius: var(--r-ctrl); padding: 12px 14px; }

/* progreso de estados */
.progreso { display: flex; gap: 4px; margin: 14px 0 4px; }
.progreso i { flex: 1; height: 6px; border-radius: 3px; background: #e6e6e1; }
.progreso i.hecho { background: var(--c); }

/* toast, visor y modal */
#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 8px); background: #1d1e22; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: var(--t-meta); font-weight: 600; z-index: 100; max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.25); opacity: 0; transition: opacity 180ms ease, transform 220ms var(--ease); pointer-events: none; }
#toast.ver { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--error); }
.visor { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 90; display: grid; place-items: center; padding: 12px; }
.visor img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.modal-fondo { position: fixed; inset: 0; background: rgba(12, 13, 18, .5); z-index: 80; display: flex; align-items: flex-end; justify-content: center; animation: aparecer 160ms ease; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px)); max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; animation: subir 240ms var(--ease); }
@keyframes aparecer { from { opacity: 0; } }
@keyframes subir { from { transform: translateY(24px); opacity: .6; } }
@media (min-width: 600px) { .modal-fondo { align-items: center; } .modal { border-radius: 18px; } }

/* ingreso y registro */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: #eef2fb; }
.login .tarjeta { width: 100%; max-width: 400px; padding: 26px 22px; box-shadow: 0 10px 30px -12px rgba(18,26,51,.18); }
.marca { font-weight: 600; font-size: 1.5rem; color: var(--texto); letter-spacing: -0.02em; text-decoration: none; }
.marca small { display: block; font-weight: 400; font-size: var(--t-meta); color: var(--gris); letter-spacing: 0; margin-top: 2px; }

/* vista del cliente */
.cab-cliente { background: var(--c); color: #fff; padding: calc(18px + env(safe-area-inset-top, 0px)) 16px 46px; }
.cab-cliente .contenedor { padding: 0; display: flex; gap: 12px; align-items: center; }
.cab-cliente img { height: 58px; max-width: 124px; object-fit: contain; background: #fff; border-radius: 12px; padding: 5px; flex-shrink: 0; }
.cab-cliente .nom { font-weight: 600; font-size: var(--t-lead); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.cab-cliente .dat { font-size: var(--t-small); opacity: .88; }
.sube { margin-top: -30px; }
.grande { font-size: var(--t-head); font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; overflow-wrap: anywhere; }
.num-orden { font-variant-numeric: tabular-nums; color: var(--gris); font-size: var(--t-small); font-weight: 600; }

.tabla-admin { width: 100%; border-collapse: collapse; font-size: var(--t-meta); }
.tabla-admin td, .tabla-admin th { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--borde); vertical-align: top; overflow-wrap: anywhere; }
.tabla-admin th { font-size: var(--t-small); color: var(--gris); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* botones de método de pago (entrega) */
.opciones-pago { display: flex; flex-wrap: wrap; gap: 8px; }
.opciones-pago button { border: 1.5px solid var(--borde); background: #fff; color: var(--texto); border-radius: 99px; padding: 0 14px; min-height: 40px; font: inherit; font-size: var(--t-meta); font-weight: 600; cursor: pointer; touch-action: manipulation; }
.opciones-pago button.activo { background: var(--c); border-color: var(--c); color: #fff; }

/* resumen del mes en el panel (solo administrador) */
.resumen-mes { display: flex; align-items: center; gap: 12px; background: var(--tarjeta); border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; color: var(--texto); text-decoration: none; box-shadow: 0 1px 2px rgba(16,24,40,.05); transition: transform 120ms var(--ease); }
.resumen-mes:active { transform: scale(.985); }
.resumen-mes .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--c-suave); color: var(--c); flex-shrink: 0; }
.resumen-mes .ic .ico { width: 20px; height: 20px; }
.resumen-mes small { display: block; font-size: var(--t-small); color: var(--gris); font-weight: 600; }
.resumen-mes b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.resumen-mes .t { flex: 1; min-width: 0; }
.resumen-mes .g { text-align: right; }
.resumen-mes .g b { color: var(--ok); }
.resumen-mes .g.neg b { color: var(--error); }
.resumen-mes > .ico { width: 18px; height: 18px; color: var(--gris-2); flex-shrink: 0; }
