/* ===== TallerIL — Sistema de diseño v2 (claro, limpio, naranja) ===== */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #f5f6f8;
  --bg-panel: #ffffff;
  --bg-soft: #eef0f3;
  --line: #e3e6eb;
  --grid-line: #e3e6eb;          /* compat */
  --ink: #16202a;
  --paper: #16202a;              /* compat */
  --ink-2: #4b5a69;
  --steel: #4c6b82;              /* compat */
  --steel-light: #5d6d7d;        /* compat (texto secundario, contraste AA) */
  --orange: #ff6a1a;
  --orange-dark: #d9500a;
  --orange-soft: #fff1e8;
  --on-orange: #1d0e04;
  --amber: #b36f00;
  --amber-soft: #fff4dd;
  --red: #c73f34;
  --red-soft: #fdebe9;
  --green: #23824a;
  --green-soft: #e6f5ec;
  --blue: #2f6f9f;
  --blue-soft: #e8f1f8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22,32,42,.05), 0 4px 14px rgba(22,32,42,.05);
  --sans: 'Barlow Condensed', 'Arial Narrow', sans-serif;   /* títulos y números */
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: var(--body);           /* compat: se acabó la fuente monoespaciada */
  --side-w: 232px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--body);
  font-size: 15px; line-height: 1.45; min-height: 100vh; min-height: 100dvh;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell: menú lateral (PC) + barra inferior (celular) ---------- */
.til-side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--bg-panel);
  border-right: 1px solid var(--line); display: none; flex-direction: column; padding: 18px 12px; z-index: 20;
}
.til-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.til-brand img { width: 34px; height: 34px; border-radius: 9px; }
.til-brand b { font-family: var(--sans); font-size: 24px; font-weight: 700; letter-spacing: .2px; }
.til-brand b i { font-style: normal; color: var(--orange); }
.til-side nav { display: flex; flex-direction: column; gap: 2px; }
.til-side a, .til-side button.til-link {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 9px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14.5px; position: relative;
  background: none; border: none; cursor: pointer; font-family: var(--body); width: 100%; text-align: left;
}
.til-side a:hover, .til-side button.til-link:hover { background: var(--bg-soft); color: var(--ink); }
.til-side a.active { background: var(--orange-soft); color: var(--ink); font-weight: 600; }
.til-side a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--orange); }
.til-side a.active .ico { color: var(--orange-dark); }
.til-side .til-spacer { flex: 1; }

.til-topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top));
}
.til-topbar .til-brand { padding: 0; }
.til-topbar .til-brand img { width: 28px; height: 28px; }
.til-topbar .til-brand b { font-size: 21px; }

.til-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--bg-panel);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}
.til-tabbar a, .til-tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 58px; font-size: 11.5px; font-weight: 500; color: var(--ink-2); text-decoration: none;
  background: none; border: none; cursor: pointer; font-family: var(--body); position: relative;
  -webkit-tap-highlight-color: transparent;
}
.til-tabbar a.active { color: var(--ink); font-weight: 600; }
.til-tabbar a.active .ico { color: var(--orange-dark); }
.til-tabbar a.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--orange); }

body.til-app { padding-bottom: 66px; }
@media (min-width: 900px) {
  .til-side { display: flex; }
  .til-topbar, .til-tabbar { display: none; }
  body.til-app { padding-left: var(--side-w); padding-bottom: 0; }
}

/* ---------- Layout ---------- */
.til-main { padding: 18px 14px 90px; max-width: 1080px; margin: 0 auto; }
@media (min-width: 900px) { .til-main { padding: 32px 36px 60px; } }

.til-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.til-page-title { font-family: var(--sans); font-size: 34px; font-weight: 700; line-height: 1.05; letter-spacing: .2px; }
.til-page-sub { color: var(--ink-2); font-size: 14px; margin-top: 3px; }
.til-section { font-family: var(--sans); font-size: 21px; font-weight: 600; margin: 26px 0 10px; display: flex; align-items: baseline; justify-content: space-between; }
.til-section a { font-family: var(--body); font-size: 13.5px; font-weight: 500; color: var(--orange-dark); text-decoration: none; }

/* ---------- Cards ---------- */
.til-card {
  background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.til-card-title { font-family: var(--sans); font-size: 20px; font-weight: 600; color: var(--ink); margin-bottom: 12px; letter-spacing: .2px; }
.til-hint { font-size: 13px; color: var(--ink-2); }

/* ---------- Formularios ---------- */
.til-field { margin-bottom: 14px; }
.til-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.til-input, .til-select, .til-textarea {
  width: 100%; background: #fff; border: 1.5px solid #cfd5dc; color: var(--ink);
  padding: 11px 13px; border-radius: 10px; font-size: 16px; font-family: var(--body); min-height: 46px;
}
.til-input::placeholder, .til-textarea::placeholder { color: #8795a3; }
.til-input:focus, .til-select:focus, .til-textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,106,26,.18); }
.til-textarea { resize: vertical; min-height: 84px; }
.til-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .til-row { grid-template-columns: 1fr; } }

.til-search { position: relative; margin-bottom: 12px; }
.til-search .ico { position: absolute; left: 13px; top: 13px; color: #7b8a99; width: 20px; height: 20px; }
.til-search input { padding-left: 42px; }

/* ---------- Botones ---------- */
.til-btn {
  font-family: var(--body); font-size: 14.5px; font-weight: 600; border: 1.5px solid transparent; border-radius: 10px;
  padding: 0 18px; min-height: 46px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  -webkit-tap-highlight-color: transparent; text-decoration: none; transition: background .15s, border-color .15s;
}
.til-btn-primary { background: var(--orange); color: var(--on-orange); }
.til-btn-primary:hover { background: #ff7d36; }
.til-btn-ghost { background: #fff; border-color: #cfd5dc; color: var(--ink); }
.til-btn-ghost:hover { background: var(--bg-soft); }
.til-btn-danger { background: #fff; border-color: #e6b4af; color: var(--red); }
.til-btn-danger:hover { background: var(--red-soft); }
.til-btn-block { width: 100%; }
.til-btn-sm { padding: 0 12px; min-height: 38px; font-size: 13.5px; border-radius: 9px; }
.til-btn[disabled] { opacity: .55; cursor: default; }
.til-btn-wa { background: #1fa855; color: #fff; }

/* ---------- Estados ---------- */
.til-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.til-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.til-badge-recibido { background: var(--bg-soft); color: #4b5a69; }
.til-badge-diagnostico { background: var(--blue-soft); color: var(--blue); }
.til-badge-reparando { background: var(--amber-soft); color: var(--amber); }
.til-badge-esperando_repuesto { background: var(--red-soft); color: var(--red); }
.til-badge-listo { background: var(--green-soft); color: var(--green); }
.til-badge-entregado { background: var(--bg-soft); color: #6b7886; }

/* avance de la orden */
.til-progress { display: flex; gap: 3px; }
.til-progress i { flex: 1; height: 5px; border-radius: 3px; background: var(--bg-soft); }
.til-progress i.on { background: var(--orange); }
.til-progress.done i.on { background: var(--green); }

/* ---------- La placa: identidad visual del sistema ---------- */
.placa {
  display: inline-flex; align-items: center; font-family: var(--sans); font-weight: 700; font-size: 19px; letter-spacing: 1.5px;
  color: #111; background: #fff; border: 2px solid #1b2530; outline: 2px solid #fff; box-shadow: 0 0 0 3.5px #c9d0d8;
  border-radius: 5px; padding: 0 9px; height: 30px; line-height: 1; white-space: nowrap; margin: 4px 4px 4px 4px;
}
.placa.lg { font-size: 30px; height: 46px; padding: 0 16px; border-width: 2.5px; letter-spacing: 2.5px; }
.placa.sm { font-size: 15px; height: 24px; padding: 0 7px; letter-spacing: 1px; }

/* ---------- Listas ---------- */
.til-list { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.til-list > * + * { border-top: 1px solid var(--line); }
.til-list-item {
  display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; padding: 14px 16px; background: var(--bg-panel);
}
a.til-list-item:hover { background: #fafbfc; }
.til-list-item .grow { flex: 1; min-width: 0; }
.til-list-item-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.til-list-item-title { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.til-list-item-sub { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.til-list-item .meta { text-align: right; font-size: 12.5px; color: var(--ink-2); flex: none; }
.late { color: var(--red) !important; font-weight: 600; }
.til-empty { text-align: center; padding: 44px 20px; color: var(--ink-2); font-size: 14.5px; }
.til-empty .ico { width: 34px; height: 34px; color: #aab4be; margin-bottom: 8px; }
.til-empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 3px; }

/* filtros (chips) */
.til-filtros { display: flex; gap: 8px; margin: 0 -14px 14px; padding: 2px 14px 4px; overflow-x: auto; scrollbar-width: none; }
.til-filtros::-webkit-scrollbar { display: none; }
.til-filtro {
  font-family: var(--body); font-size: 13.5px; font-weight: 500; white-space: nowrap; padding: 0 14px; min-height: 38px; border-radius: 999px;
  border: 1.5px solid #cfd5dc; color: var(--ink-2); background: #fff; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.til-filtro .n { font-size: 12px; background: var(--bg-soft); border-radius: 999px; padding: 0 7px; color: var(--ink-2); }
.til-filtro.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.til-filtro.active .n { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- FAB ---------- */
.til-fab {
  position: fixed; right: 18px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 15; background: var(--orange); color: var(--on-orange);
  border: none; border-radius: 16px; min-width: 56px; height: 56px; padding: 0 18px; font-family: var(--body); font-size: 15px; font-weight: 600; cursor: pointer;
  box-shadow: 0 8px 22px rgba(217,80,10,.35); display: flex; align-items: center; justify-content: center; gap: 8px;
}
.til-fab .txt { display: none; }
@media (min-width: 900px) { .til-fab { bottom: 28px; right: 36px; } .til-fab .txt { display: inline; } }

/* ---------- Modal / hoja ---------- */
.til-modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(22,32,42,.45); z-index: 40; align-items: flex-end; justify-content: center; }
.til-modal-backdrop.open { display: flex; }
.til-modal {
  background: var(--bg-panel); border-radius: 18px 18px 0 0; padding: 22px 18px; width: 100%; max-width: 540px;
  max-height: 92vh; overflow-y: auto; padding-bottom: calc(22px + env(safe-area-inset-bottom)); animation: sube .2s ease-out;
}
@keyframes sube { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 720px) { .til-modal-backdrop { align-items: center; } .til-modal { border-radius: 16px; padding: 26px; } }
.til-modal-title { font-family: var(--sans); font-size: 26px; font-weight: 700; margin-bottom: 16px; }
.til-modal-actions { display: flex; gap: 10px; margin-top: 12px; }

/* ---------- Estadísticas ---------- */
.til-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.til-stat { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.til-stat-num { font-family: var(--sans); font-size: 38px; font-weight: 700; line-height: 1; }
.til-stat-label { font-size: 13px; color: var(--ink-2); margin-top: 5px; }
.til-stat.alert { border-color: #e6b4af; background: var(--red-soft); }
.til-stat.alert .til-stat-num { color: var(--red); }

/* ---------- Avisos (toast) y confirmaciones ---------- */
.til-toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { .til-toasts { bottom: 28px; } }
.til-toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px; font-size: 14.5px; font-weight: 500; display: flex; gap: 10px; align-items: center; box-shadow: 0 10px 28px rgba(0,0,0,.25); animation: sube .2s ease-out; }
.til-toast.ok .ico { color: #5fd38d; } .til-toast.error { background: #8f2a22; } .til-toast.error .ico { color: #ffd0cb; }
.til-confirm { max-width: 400px; }
.til-confirm p { color: var(--ink-2); margin-bottom: 16px; }

/* ---------- Varios ---------- */
.til-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--bg-soft); color: var(--ink-2); }
.til-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14.5px; }
.til-kv dt { color: var(--ink-2); } .til-kv dd { font-weight: 500; }
.til-spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: gira .8s linear infinite; margin: 30px auto; }
@keyframes gira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* placas en listas: ancho parejo para que las barras de avance alineen */
.til-list-item > .placa { min-width: 124px; justify-content: center; }
.til-list-item .meta { min-width: 62px; }
.til-list-item-top { flex-wrap: wrap; row-gap: 4px; }
.til-list-item-top .til-list-item-title { flex: 1 1 90px; min-width: 90px; }
@media (max-width: 560px) {
  .til-list-item { gap: 10px; padding: 12px; }
  .til-list-item > .placa { min-width: 86px; font-size: 15px; height: 26px; padding: 0 6px; letter-spacing: 1px; align-self: flex-start; margin-top: 2px; }
  .til-list-item .meta { min-width: 0; }
}
