:root {
  --brand:      #e8621a;
  --brand-dark: #c04b14;
  --brand-bg:   #fff4ed;
  --success:    #22c55e;
  --danger:     #ef4444;
  --warning:    #f59e0b;
  --text:       #1c1612;
  --muted:      #6b5040;
  --border:     #e8e0d8;
  --bg:         #f7f4f1;
  --white:      #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* ── Header ──────────────────────────────────────────────────────── */
.header {
  background: var(--brand-dark);
  color: white;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.header-logo {
  height: 30px;
  border-radius: 6px;
  background: white;
  padding: 3px 7px;
  object-fit: contain;
  flex-shrink: 0;
}
.header-back {
  color: white;
  font-size: 24px;
  text-decoration: none;
  line-height: 1;
  flex-shrink: 0;
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}
.header-title { font-size: 16px; font-weight: 700; line-height: 1.2; }
.header-sub   { font-size: 11px; opacity: 0.75; }

/* ── Layout ──────────────────────────────────────────────────────── */
.main {
  padding: 18px 16px 110px;
  max-width: 640px;
  margin: 0 auto;
}

/* ── Tarjetas ────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  border: 1px solid var(--border);
}
.card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ── Botones ─────────────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.1px;
}
.btn:active   { transform: scale(0.97); opacity: 0.85; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-primary  { background: var(--brand);   color: white; }
.btn-dark     { background: var(--brand-dark); color: white; }
.btn-success  { background: var(--success); color: white; }
.btn-danger   { background: var(--danger);  color: white; }
.btn-secondary { background: var(--brand-bg); color: var(--brand-dark); }
.btn-outline  { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
.btn-ghost    { background: transparent; color: var(--muted); border: 2px solid var(--border); }

/* ── Inputs ──────────────────────────────────────────────────────── */
.label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  color: var(--text);
  background: white;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}
.input:focus  { outline: none; border-color: var(--brand); }
.input-group  { margin-bottom: 18px; }

/* ── Tarjeta de unidad (lista plan del día) ──────────────────────── */
.unit-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.unit-card:active { box-shadow: 0 4px 14px rgba(232,98,26,0.2); border-color: #ffa066; }
.unit-icon   { font-size: 30px; flex-shrink: 0; }
.unit-info   { flex: 1; min-width: 0; }
.unit-code   { font-weight: 700; font-family: monospace; font-size: 15px; color: var(--brand-dark); }
.unit-tipo   { font-size: 11px; color: var(--muted); margin-top: 1px; }
.unit-cliente { font-size: 13px; font-weight: 600; margin-top: 3px; }
.unit-faena  { font-size: 12px; color: var(--muted); }
.unit-arrow  { font-size: 22px; color: var(--brand); flex-shrink: 0; }
.unit-check  { font-size: 22px; flex-shrink: 0; }

/* ── Fila info (detalle de unidad) ──────────────────────────────── */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.info-value { font-weight: 600; text-align: right; }

/* ── Área de foto ────────────────────────────────────────────────── */
.photo-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s;
}
.photo-area.has-photo { border-color: var(--success); border-style: solid; }
.photo-area-icon { font-size: 40px; margin-bottom: 8px; }
.photo-thumb {
  width: 100%;
  border-radius: 10px;
  max-height: 240px;
  object-fit: cover;
  margin-top: 14px;
  display: none;
}

/* ── GPS ──────────────────────────────────────────────────────────── */
.gps-box {
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 13px;
  margin-top: 12px;
  line-height: 1.5;
}
.gps-ok      { background: #dcfce7; color: #15803d; }
.gps-error   { background: #fee2e2; color: #991b1b; }
.gps-loading { background: #fef3c7; color: #92400e; }

/* ── Alertas ─────────────────────────────────────────────────────── */
.alert {
  padding: 13px 15px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warn    { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── Loading ─────────────────────────────────────────────────────── */
.loading { text-align: center; padding: 40px 20px; color: var(--muted); }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-icon { font-size: 52px; margin-bottom: 14px; }
.empty-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }

/* ── FAB (botón flotante) ────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 16px 28px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(232,98,26,0.45);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 9px;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  z-index: 50;
}
.fab:active { transform: translateX(-50%) scale(0.96); }

/* ── Badge frecuencia ────────────────────────────────────────────── */
.freq-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  background: var(--brand-bg);
  color: var(--brand-dark);
}
