:root {
  --blue: #1565C8;
  --blue-d: #0D47A6;
  --blue-l: #E3F2FD;
  --ink: #122033;
  --muted: #5b6b80;
  --line: #d7e0ea;
  --bg: #eef3f8;
  --card: #fff;
  --ok: #2e7d32;
  --warn: #ef6c00;
  --bad: #c62828;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(13, 71, 166, .08);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
}
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; }

.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 8px 14px;
  background: var(--blue); color: #fff;
}
.appbar .brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 800; letter-spacing: .4px; }
.appbar .brand img { width: 32px; height: 32px; border-radius: 8px; background: #fff; }
.appbar .grow { flex: 1; }
.appbar .who { font-size: 12px; opacity: .9; text-align: right; }
.appbar .who b { display: block; font-size: 13px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 14px; }
#fotos, #presupuesto, #paso-revision, #paso-reparacion { scroll-margin-top: 72px; }
html { scroll-behavior: smooth; }

.steps { display: flex; gap: 6px; margin-bottom: 12px; }
.step {
  flex: 1; min-width: 0; text-align: center;
  font-size: 11px; font-weight: 700; color: var(--muted);
  padding: 8px 4px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line);
}
.step b { display: block; font-size: 12px; margin-bottom: 2px; }
.step.on { background: var(--blue-l); color: var(--blue-d); border-color: var(--blue); }
.step.done { background: #e8f5e9; color: #1b5e20; border-color: #a5d6a7; }
.step.lock { opacity: .5; }
.field.invalid textarea, .field.invalid input { border-color: var(--bad); background: #fff8f8; }
.err-msg { color: var(--bad); font-size: 13px; font-weight: 700; margin-top: 6px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.card h2, .card h3 { margin: 0 0 10px; font-size: 16px; }

.row { display: flex; flex-wrap: wrap; gap: 10px; }
.row > * { flex: 1 1 180px; }

label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 4px; font-weight: 600; }
input:not([type="file"]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; padding: 12px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 16px; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 14px; border: 0; border-radius: 10px;
  background: var(--blue); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn.sec { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
.btn.ok { background: var(--ok); }
.btn.warn { background: var(--warn); }
.btn.bad { background: var(--bad); }
.btn.full { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 10px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.badge {
  display: inline-block; padding: 4px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.3;
}
.st-pendiente_revisar { background: #e3f2fd; color: #1565c8; }
.st-pendiente_presupuesto { background: #fff3e0; color: #ef6c00; }
.st-pendiente_autorizacion { background: #f3e5f5; color: #7b1fa2; }
.st-pendiente_repuesto { background: #fff8e1; color: #f9a825; }
.st-reparado { background: #e8f5e9; color: #2e7d32; }
.st-presupuesto_rechazado { background: #ffebee; color: #c62828; }

.flash {
  position: sticky; top: 8px; z-index: 19;
  padding: 12px 14px; border-radius: 10px; margin-bottom: 12px;
  font-size: 15px; font-weight: 700; box-shadow: var(--shadow);
}
.flash.ok { background: #e8f5e9; color: #1b5e20; }
.flash.bad { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }
.flash.warn { background: #fff8e1; color: #e65100; }

.list { list-style: none; margin: 0; padding: 0; }
.list a.item, .item {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-bottom: 8px; color: inherit;
}
.item .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.item .num { font-weight: 800; color: var(--blue-d); }
.item .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.filters { display: flex; gap: 8px; margin-bottom: 12px; }
.filters input, .filters select { margin: 0; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gallery a, .gallery img {
  display: block; width: 100%; height: 96px; object-fit: cover; border-radius: 10px; background: #ddd;
}
.shot { position: relative; }
.shot-del { position: absolute; top: 4px; right: 4px; margin: 0; }
.shot-del .btn { min-height: 28px; padding: 2px 8px; }

.file-btn {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 92px; padding: 14px; margin: 8px 0 10px;
  border: 2px dashed var(--blue); border-radius: 12px;
  background: var(--blue-l); color: var(--blue-d);
  font-weight: 800; text-align: center; cursor: pointer;
}
.file-btn input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; padding: 0; border: 0; margin: 0; font-size: 28px;
}
.file-btn-text { pointer-events: none; font-size: 15px; line-height: 1.35; }
.jumps { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.jumps a { background: #fff; border: 1px solid var(--blue); color: var(--blue); border-radius: 999px; padding: 8px 12px; font-size: 13px; font-weight: 700; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; }
.table th { font-size: 12px; color: var(--muted); }
.table .r { text-align: right; }

.navb {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.navb a {
  flex: 1; text-align: center; padding: 8px 4px 6px; color: var(--muted); font-size: 11px; font-weight: 700;
}
.navb a.on, .navb a:active { color: var(--blue); }
.navb svg { display: block; margin: 0 auto 2px; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(180deg, var(--blue) 0 42%, var(--bg) 42%);
}
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 22px; box-shadow: var(--shadow); }
.login-card .logo { text-align: center; margin: -70px 0 12px; }
.login-card .logo img { width: 86px; height: 86px; border-radius: 20px; border: 4px solid #fff; }
.login-card h1 { margin: 0 0 4px; text-align: center; color: var(--blue-d); font-size: 22px; }
.login-card p.sub { margin: 0 0 16px; text-align: center; color: var(--muted); font-size: 13px; }

.muted { color: var(--muted); font-size: 13px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 8px; font-size: 14px; }
.kv b { color: var(--muted); font-weight: 600; }

@media (min-width: 800px) {
  body { padding-bottom: 20px; }
  .navb { display: none; }
  .desk-nav { display: flex !important; gap: 8px; }
  .desk-nav a { color: #fff; font-weight: 700; font-size: 13px; padding: 6px 8px; border-radius: 8px; }
  .desk-nav a.on { background: rgba(255,255,255,.18); }
}
.desk-nav { display: none; }

@media print {
  .appbar, .navb, .no-print, .actions, .flash { display: none !important; }
  body { background: #fff; padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; }
}
