/* ====== CheckPilot · sistema de diseño ====== */
:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #1d4ed8;
  --primary-h: #1e40af;
  --primary-soft: #eff4ff;
  --green: #15803d; --green-bg: #dcfce7;
  --amber: #b45309; --amber-bg: #fef3c7;
  --red: #b91c1c;   --red-bg: #fee2e2;
  --r: 14px; --r-sm: 9px;
  --sh-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --sh-md: 0 4px 12px rgba(15,23,42,.08);
  --sh-lg: 0 18px 40px rgba(15,23,42,.14);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5;
  font-size: 15px; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 600; }
a { color: var(--primary); text-decoration: none; }
p { color: var(--ink); }
.muted { color: var(--muted); font-size: .9rem; }

/* ---- Controles ---- */
button {
  cursor: pointer; font: inherit; font-weight: 600; border: 0;
  border-radius: var(--r-sm); padding: 11px 18px; min-height: 44px;
  background: var(--primary); color: #fff; transition: background .15s, transform .05s;
}
button:hover { background: var(--primary-h); }
button:active { transform: translateY(1px); }
button.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
button.ghost:hover { background: var(--surface-2); }
button.danger { background: var(--red); }
button.full { width: 100%; }
button:disabled { opacity: .55; cursor: not-allowed; }

input, select {
  font: inherit; width: 100%; min-height: 44px; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: 0; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.15);
}
label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted);
  margin: 14px 0 5px; text-transform: uppercase; letter-spacing: .03em; }

/* ---- Auth ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(160deg, #0f172a 0%, #1e3a8a 100%); }
.auth-card { background: var(--surface); padding: 36px; border-radius: 18px;
  box-shadow: var(--sh-lg); width: 100%; max-width: 430px; }
.auth-card h1 { font-size: 1.6rem; font-weight: 800; }
.auth-card p.sub { color: var(--muted); margin: 6px 0 20px; }
.auth-card .full { margin-top: 22px; }
.switch { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--muted); }
.err { background: var(--red-bg); color: var(--red); padding: 11px 13px;
  border-radius: var(--r-sm); font-size: .9rem; margin-top: 14px; }

/* ---- Layout app ---- */
header { background: #0f172a; color: #fff; padding: 14px 20px; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header .brand { font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
header .who { font-size: .82rem; color: #94a3b8; }
header .who b { color: #e2e8f0; }
header button.ghost { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.18);
  min-height: 38px; padding: 8px 14px; }
header button.ghost:hover { background: rgba(255,255,255,.16); }

nav { background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; gap: 2px; padding: 0 12px; overflow-x: auto; position: sticky; top: 64px; z-index: 19;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav button { background: none; color: var(--muted); border-radius: 0; min-height: 50px;
  border-bottom: 3px solid transparent; padding: 14px 16px; white-space: nowrap; font-weight: 600; }
nav button:hover { background: none; color: var(--ink); }
nav button.active { color: var(--primary); border-bottom-color: var(--primary); }

main { max-width: 1080px; margin: 22px auto; padding: 0 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 22px; box-shadow: var(--sh-sm); margin-bottom: 18px; }
.card > h2 { margin-bottom: 4px; }
.card > h2 + .muted { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---- Tablas ---- */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 460px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }

/* ---- Etiquetas ---- */
.tag { display: inline-block; font-size: .7rem; padding: 3px 9px; border-radius: 999px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.tag.mecanica { background: #dbeafe; color: #1e40af; }
.tag.carroceria { background: #fce7f3; color: #9d174d; }
.tag.atencion, .tag.regla { background: var(--amber-bg); color: var(--amber); }
.tag.urgente, .tag.inspeccion { background: var(--red-bg); color: var(--red); }
.tag.historial, .tag.ok { background: var(--green-bg); color: var(--green); }

/* ---- Líneas de presupuesto / recomendación ---- */
.rec { border: 1px solid var(--border); border-left: 5px solid var(--amber);
  border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 14px; background: var(--surface); }
.rec.urgente { border-left-color: var(--red); background: #fff8f8; }
.rec.inspeccion { border-left-color: var(--amber); }
.rec .reason { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.rec .price { font-weight: 800; font-size: 1.05rem; color: var(--ink); white-space: nowrap; }
.total-line { text-align: right; margin-top: 16px; font-size: 1.15rem; font-weight: 800; }
.total-line small { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); }

/* ---- Checklist (tarjetas táctiles, mobile-first) ---- */
.block { margin-bottom: 22px; }
.block-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--primary); background: var(--primary-soft); padding: 9px 12px;
  border-radius: var(--r-sm); margin-bottom: 10px; }
.ci { border: 1px solid var(--border); border-radius: var(--r); padding: 14px;
  margin-bottom: 10px; background: var(--surface); }
.ci-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.ci-num { font-size: .78rem; font-weight: 700; color: var(--muted); min-width: 22px; }
.ci-label { font-weight: 600; flex: 1; }
.seg { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.seg button { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
  min-height: 46px; font-size: .9rem; border-radius: var(--r-sm); }
.seg button:hover { background: #eef2f7; }
.seg button.on[data-v="ok"] { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.seg button.on[data-v="atencion"] { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }
.seg button.on[data-v="urgente"] { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.ci-extra { display: grid; grid-template-columns: 1fr; gap: 8px; }
.ci-extra input { min-height: 42px; }
.ci-photo { display: flex; align-items: center; gap: 10px; }
.photobtn { cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 14px; font-weight: 600; font-size: .9rem; min-height: 42px; user-select: none; }
.photobtn:hover { background: #eef2f7; }
.phc { font-size: .82rem; color: var(--green); font-weight: 700; }
.rem-box { background: var(--amber-bg); border: 1px solid var(--amber);
  border-radius: var(--r-sm); padding: 10px; display: grid; gap: 8px; }
.rem-t { font-size: .8rem; font-weight: 700; color: var(--amber); }
.rem-box input { min-height: 40px; background: #fff; }

/* Escritorio: línea de checklist en una fila */
@media (min-width: 860px) {
  .ci { display: grid; grid-template-columns: 1.4fr 1.5fr 1.4fr; gap: 14px; align-items: center; }
  .ci-top { margin-bottom: 0; }
  .seg { margin-bottom: 0; }
  .ci-extra { grid-template-columns: 1fr; }
}

/* Stats */
.kpi { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 6px; }
.kpi .box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; text-align: center; }
.kpi .box .n { font-size: 1.7rem; font-weight: 800; }
.kpi .box .l { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* Móvil */
@media (max-width: 640px) {
  body { font-size: 14px; }
  main { margin: 14px auto; padding: 0 12px; }
  .card { padding: 16px; border-radius: 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .kpi { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .kpi .box { padding: 12px 8px; }
  .kpi .box .n { font-size: 1.3rem; }
  nav { top: 60px; }
  header { padding: 12px 16px; }
  .rec { flex-direction: column; align-items: flex-start; }
  .rec .price { align-self: flex-end; }
  .row-actions button { flex: 1; }
}
