* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif; background: #f2f4f7; color: #1a2233; }
.view { min-height: 100vh; }
.hidden { display: none !important; }

/* LOGIN */
#login-view { display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: #fff; padding: 32px 24px; border-radius: 16px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,.08); }
.login-box h1 { font-size: 22px; margin-bottom: 24px; text-align: center; color: #1f4ed8; }

input, textarea, select, button { width: 100%; padding: 13px 14px; margin-bottom: 12px; border: 1px solid #d6dbe4; border-radius: 10px; font-size: 16px; }
textarea { min-height: 70px; resize: vertical; }
button { background: #1f4ed8; color: #fff; border: none; font-weight: 600; cursor: pointer; transition: background .15s; }
button:hover { background: #1a3fb0; }
button.link { width: auto; background: none; color: #1f4ed8; padding: 4px 8px; }
#btn-geocode { background: #475569; }

.error { color: #d33; font-size: 14px; min-height: 18px; }
.ok { color: #1a8a3f; font-size: 14px; min-height: 18px; }
.hint { font-size: 13px; color: #6b7280; margin-bottom: 10px; }

/* HEADER + TABS */
header { background: #1f4ed8; color: #fff; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; }
header .link { color: #fff; }
#user-name { font-weight: 600; }
.tabs { display: flex; background: #fff; border-bottom: 1px solid #e2e6ee; overflow-x: auto; }
.tab { width: auto; flex: 1; background: none; color: #475569; border: none; border-bottom: 3px solid transparent; border-radius: 0; padding: 14px 10px; margin: 0; font-size: 14px; white-space: nowrap; }
.tab.active { color: #1f4ed8; border-bottom-color: #1f4ed8; }

.tab-content { padding: 16px; max-width: 720px; margin: 0 auto; }

.map { width: 100%; height: 220px; border-radius: 12px; margin-bottom: 12px; z-index: 1; }
.map-big { height: 360px; }
.gps-status { font-size: 13px; color: #6b7280; margin-bottom: 12px; }

/* CARDS */
.card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.card h4 { font-size: 16px; margin-bottom: 4px; }
.card p { font-size: 14px; color: #475569; margin: 2px 0; }
.badge { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 20px; font-weight: 600; }
.badge.pendiente { background: #fff3cd; color: #92670a; }
.badge.visitado { background: #d4edda; color: #1a8a3f; }
.card .acciones { display: flex; gap: 8px; margin-top: 8px; }
.card .acciones button { width: auto; padding: 8px 12px; font-size: 13px; margin: 0; }
.btn-ir { background: #0ea5a4; }
hr { border: none; border-top: 1px solid #e2e6ee; margin: 24px 0; }
h2, h3 { margin-bottom: 14px; }

/* Historial: buscador + export */
#buscar-historial { margin-bottom: 12px; }
#export-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-bottom: 12px;
  background: #fff; padding: 12px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
#export-tools label { flex: 1; min-width: 120px; font-size: 12px; color: #6b7280; margin: 0; }
#export-tools input { width: 100%; margin: 4px 0 0; }
#btn-export { width: auto; flex: 0 0 auto; background: #1a8a3f; margin: 0; padding: 13px 18px; }
#btn-export:hover { background: #15722f; }
#historial-count { margin-top: 0; }
