:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --ink: #15161a;
  --ink-dim: #63656b;
  --accent: #ffcd11;
  --accent-ink: #15161a;
  --accent-deep: #8a6a00;
  --accent-wash: #fff5cf;
  --line: rgba(21, 22, 26, 0.14);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Outfit', sans-serif;
}

/* ---------- contenedor de páginas de formulario ---------- */

.envoltorio {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px) 20px 60px;
}

.envoltorio.ancho { max-width: 760px; }

h1 {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 40px 0 16px;
}

.subtitulo {
  color: var(--ink-dim);
  font-size: 0.98rem;
  margin: 0 0 28px;
}

.aviso {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.95rem;
  margin-bottom: 22px;
}

.aviso-ok { background: #e7f5ec; color: #1c6b3a; border: 1px solid #bfe6cc; }
.aviso-error { background: #fbe9e7; color: #a33327; border: 1px solid #f3c6c0; }

/* ---------- formularios ---------- */

form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(20px, 4vw, 32px);
}

.fila { display: grid; grid-template-columns: 1fr; gap: 18px; }

@media (min-width: 560px) {
  .fila-doble { grid-template-columns: 1fr 1fr; }
}

.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }

.campo label { font-size: 13.5px; font-weight: 500; color: var(--ink-dim); }

.campo input,
.campo select,
.campo textarea {
  font-family: inherit;
  font-size: 15px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.campo textarea { resize: vertical; min-height: 70px; }

.requerido { color: var(--accent-deep); }

button {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

button:hover { background: #e6b800; }
button:active { transform: scale(0.99); }

/* ---------- historial de mantenimientos ---------- */

.selector-historial {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.selector-historial select {
  flex: 1;
  font-family: inherit;
  font-size: 14.5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.tabla-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table { width: 100%; min-width: 480px; border-collapse: collapse; font-size: 14px; }

th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

th { color: var(--ink-dim); font-weight: 500; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; }
td a { color: var(--accent-deep); text-decoration: none; font-weight: 600; }
td a:hover { text-decoration: underline; }
tr:last-child td { border-bottom: none; }

.vacio { padding: 20px; color: var(--ink-dim); font-size: 14px; text-align: center; }

/* ---------- panel ---------- */

header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 245, 243, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.cabecera {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 84px;
  padding-block: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.marca {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.marca-logo { height: 56px; width: auto; display: block; }

.marca span { color: var(--ink-dim); font-weight: 400; }

.boton-lupa {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.boton-lupa:hover { border-color: var(--accent); background: var(--accent-wash); }
.boton-lupa svg { width: 19px; height: 19px; stroke: var(--ink); }
.boton-lupa:hover svg { stroke: var(--accent-ink); }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) 20px 60px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

.tarjeta {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease;
}

.tarjeta:hover { transform: translateY(-2px); border-color: var(--accent); }

.tarjeta-icono {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-wash);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.tarjeta-icono svg { width: 20px; height: 20px; stroke: var(--accent-ink); }

.tarjeta h2 { font-size: 1.08rem; font-weight: 600; margin: 0 0 6px; }
.tarjeta p { font-size: 0.92rem; color: var(--ink-dim); margin: 0; line-height: 1.5; }

/* ---------- modal de búsqueda ---------- */

.modal-fondo {
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 26, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  z-index: 50;
}

.modal-fondo.abierto { display: flex; }

.modal {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 30px 70px -20px rgba(18, 22, 26, 0.35);
  overflow: hidden;
}

.modal-buscador {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-buscador svg { width: 18px; height: 18px; stroke: var(--ink-dim); flex-shrink: 0; }

.modal-buscador input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  background: transparent;
  color: var(--ink);
}

.modal-cerrar {
  border: none;
  background: transparent;
  color: var(--ink-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
}

.modal-cerrar:hover { color: var(--ink); }

.resultados { max-height: 340px; overflow-y: auto; }

.resultado {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 13px 18px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.resultado:last-child { border-bottom: none; }
.resultado:hover { background: var(--accent-wash); }
.resultado .principal { font-size: 14.5px; font-weight: 500; }
.resultado .secundario { font-size: 12.5px; color: var(--ink-dim); }

.estado-busqueda {
  padding: 22px 18px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 14px;
}
