/* Mobile-first: relevador y login */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.auth-body,
.app-body {
  min-height: 100dvh;
}

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.auth-title {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.auth-sub {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

.auth-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.field span {
  font-size: 0.85rem;
  color: var(--muted);
}

.field .req {
  font-style: normal;
  color: var(--accent);
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: var(--text);
  font-size: 1.05rem;
}

textarea {
  min-height: 4.5rem;
  resize: vertical;
  font-family: inherit;
}

input[type="file"] {
  width: 100%;
  font-size: 0.88rem;
  color: var(--muted);
}

.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.banner-warn {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fde68a;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.form-hallazgo .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.msg-hallazgo {
  min-height: 1.25rem;
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.msg-hallazgo.ok {
  color: var(--ok);
}

.msg-hallazgo.bad {
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #0f172a;
}

.btn-secondary {
  background: #334155;
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 0.9rem 1rem;
  font-size: 1.1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-user {
  font-size: 0.9rem;
  color: var(--muted);
}

.inline {
  display: inline;
}

.main-relevador {
  padding: 1rem 1rem 2rem;
  max-width: 480px;
  margin: 0 auto;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.15rem;
  margin-bottom: 1.25rem;
}

.panel--spaced .field:last-of-type {
  margin-bottom: 0;
}

.panel-title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.panel-title--small {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.panel--padron {
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Barra de descarga del padrón */
.padron-progress-box {
  margin-top: 1rem;
  padding: 1rem 0.85rem;
  background: rgba(15, 23, 42, 0.65);
  border-radius: 10px;
  border: 1px solid #334155;
}

.padron-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.padron-progress-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.padron-progress-pct {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.padron-progress-track {
  height: 10px;
  border-radius: 999px;
  background: #1e293b;
  overflow: hidden;
  border: 1px solid #334155;
}

.padron-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  width: 0%;
  transition: width 0.35s ease-out;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.padron-progress-bar.padron-progress-bar--busy {
  background: linear-gradient(
    90deg,
    #38bdf8 0%,
    #7dd3fc 40%,
    #38bdf8 80%
  );
  background-size: 200% 100%;
  animation: padron-progress-shine 1.2s ease-in-out infinite;
}

.padron-progress-detail {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--muted);
  min-height: 2.6rem;
}

.padron-progress-tip {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: #94a3b8;
  opacity: 0.95;
}

@keyframes padron-progress-shine {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.stack-btns {
  margin-top: 1rem;
}

.stack-btns--after-form {
  margin-top: 1.25rem;
}

.hint--spaced {
  margin-top: 1rem;
  margin-bottom: 0;
}

/* Pestañas */
.tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.65rem 1rem 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  border-bottom: 1px solid #334155;
}

.tab {
  flex: 1;
  padding: 0.65rem 0.5rem;
  border: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.tab--active {
  background: var(--surface);
  color: var(--text);
}

.view[hidden] {
  display: none !important;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  border: 1px solid #334155;
}

.modal-title {
  margin: 0 0 0.65rem;
  font-size: 1.12rem;
  line-height: 1.3;
}

.modal-body {
  margin: 0 0 1.15rem;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.45;
}

.modal--ok .modal-title {
  color: var(--ok);
}

.modal--err .modal-title {
  color: var(--danger);
}

.modal--info .modal-title {
  color: var(--accent);
}

.modal-dialog .btn-block {
  margin-top: 0.25rem;
}

/* Fotos relevamiento */
.photo-field {
  margin-bottom: 1.15rem;
}

.photo-field .field-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.photo-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
  opacity: 0.95;
}

.btn-photo {
  position: relative;
  cursor: pointer;
  text-align: center;
  margin-top: 0;
}

.photo-file-input {
  position: absolute;
  width: 0.01px;
  height: 0.01px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.photo-thumb {
  display: block;
  width: 100%;
  max-width: 220px;
  height: auto;
  margin-top: 0.75rem;
  border-radius: 8px;
  border: 1px solid #334155;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

/* Filtros historial */
.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 0.75rem;
  margin-top: 1rem;
}

/* Evita que date/select rebase el ancho (min-width:auto en ítems grid) */
.filters-grid > .field {
  min-width: 0;
  max-width: 100%;
}

.field--full {
  grid-column: 1 / -1;
}

/* Una columna en móvil: las fechas no compiten por mitad de pantalla */
@media (max-width: 420px) {
  .filters-grid {
    grid-template-columns: 1fr;
  }
}

input[type="date"],
select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.55rem 0.5rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: var(--text);
  font-size: 1rem;
  box-sizing: border-box;
}

.filters-grid input[type="date"],
.filters-grid select {
  padding: 0.5rem 0.45rem;
  font-size: 0.95rem;
}

select {
  cursor: pointer;
}

.historial-lista {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.historial-item {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.65rem;
}

.historial-item__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.historial-pat {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.historial-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: flex-end;
}

.historial-meta {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
}

.badge--lista {
  background: rgba(74, 222, 128, 0.2);
  color: var(--ok);
}

.badge--fuera {
  background: rgba(148, 163, 184, 0.2);
  color: var(--muted);
}

.badge--pendiente {
  background: rgba(251, 191, 36, 0.22);
  color: #b45309;
}

.historial-item--local .historial-meta {
  color: var(--text, inherit);
}

/* Patentes: solo mayúsculas visualmente y con JS al escribir */
input.input-patente-mayus {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.6rem 0 0;
}

.resultado {
  min-height: 1.5rem;
  margin: 0.75rem 0 0;
  font-weight: 600;
}

.resultado.ok {
  color: var(--ok);
}

.resultado.bad {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

.sync-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
